I'm using the Google Map Add-On from ObjectiveHTML. When entering a route using the field type in an EE channel entry the distance (as displayed in "Show Details") is always displayed in Kilometers. Does anyone know how this can be changed to display in miles?

2 Answers 2


I uploaded a screenshot of my default setup. I simply create a Gmap field and create a route with an origin and destination. You can see my distance is in miles. I think Google is trying to automatically determine which metric to use.

I think what you propose is a good idea though. Being able to force that metric to be something would be nice. I will do some testing to figure out how to best get that data changed and I will report back here. But for now, I don't think it's a problem with the code, rather we just need a way to override the default.

enter image description here

  • Thanks for the quick response. It would be good to over-ride the metric as it appears that Google thinks we want to see KM despite the fact that we actually use Miles here in the UK. Commented Dec 18, 2012 at 14:05
  • I managed to get around this problem by modifying gmap_field.js (in gmap's themes folder). I changed line 1068 to: var distance = Math.round((leg.distance.value * 0.000621371192)) + ' miles (' + leg.distance.text + ')'; Commented Jan 8, 2013 at 16:41
  • It seems as though the results are returned from Google in either miles or KM depending on how the route request is made (by address or by latitude/longitude) See: [link]developers.google.com/maps/documentation/javascript/… However when I test it I always seem to get KM @tom-davies Commented Jan 8, 2013 at 16:49

I'm sure Justin (ObjectiveHTML) will correct me if I'm wrong, but I don't think there is a way to configure this as an option on the FT at current. It is possible to set a metric param on {exp:gmap:search} but that's no help here.

THough I don't have a copy of the addon's source, the The Google Directions API specifies a units parameter with values of either imperial or metric. If you're willing to dig in to the code you should be able to find where the request is generated and fairly easily add a units=imperial parameter to the request.

  • Thanks. I've been digging around the code to try and locate the request but didn't have any luck. I'll see what Justin comes back with. Commented Dec 18, 2012 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.