Samples - 6.3

Talend ESB Mediation Developer Guide

EnrichVersion
6.3
EnrichProdName
Talend Data Fabric
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for ESB
Talend Real-Time Big Data Platform
task
Design and Development
EnrichPlatform
Talend ESB

In the example below we get the latitude and longitude for Paris, France

from("direct:start")
  .to("geocoder:address:Paris, France")  

If you provide a header with the CamelGeoCoderAddress then that overrides the endpoint configuration, so to get the location of Copenhagen, Denmark we can send a message with a headers as shown:

template.sendBodyAndHeader("direct:start", "Hello", GeoCoderConstants.ADDRESS, 
"Copenhagen, Denmark");

To get the address for a latitude and longitude we can do:

from("direct:start")
  .to("geocoder:latlng:40.714224,-73.961452")
  .log("Location ${header.CamelGeocoderAddress} is at lat/lng: 
  ${header.CamelGeocoderLatlng}
   and in country ${header.CamelGeoCoderCountryShort}")

Which will log

Location 285 Bedford Avenue, Brooklyn, NY 11211, USA is at lat/lng: 
40.71412890,-73.96140740 and in country US  

To get the current location you can use "current" as the address as shown:

from("direct:start")
  .to("geocoder:address:current")