I geocode an address below and get lat and long for the same town name in
North Carolina USA> I have tried +GB and +UK . Other countries are ok but problems for UK
The CF code is fine - it just appears google is giving funny results. Durham England UK gets lat long for Durham in NC USA. So what do I need to do with the data?
location = Ludworth,County Durham,England+UK
Returns
lat = 54.7665696
long = -1.4377006
Code:
</cfoutput>
<!--- function to decode the return from google --->
<cfinclude template = "jsondecode.cfm">
<cfoutput>
<cfhttp method="get"
url="
http://maps.googleapis.com/maps/api/geocode/json?address=#urlencodedformat(location)#&sensor=false"
resolveurl="no">
</cfhttp>
<cfset GeoCodeLattitude = jsondecode(cfhttp.FileCont
ent).resul
ts[1].geom
etry.locat
ion.lat />
<cfset GeoCodeLongitude = jsondecode(cfhttp.FileCont
ent).resul
ts[1].geom
etry.locat
ion.lng />
</cfoutput>
Ludworth,County Durham,England+UK
is in NC USA
So
<cfhttp method="get"
url="http://maps.googleapis.com/maps/api/geocode/json?address=#urlencodedformat(location)#&sensor=false" & region=uk
resolveurl="no">
</cfhttp>