0

I have these modules

addressfield
geofield
geocoder

Is there any function to which I can pass an address like Stree, zipcode city, Country and it returns a lat/lon from that address?

I have searched in the code of geofield and geocoder but unable to find any helper function.

1

Using google geocoding with geocoder module, you may use another geocoding provider, i think this requires a google map token now given google's new rules :

// @return Geometry Returns a geoPHP geometry object. Generally a Point.
$point = geocoder('google', $address);
$lat = $point->coords[1];
$lon = $point->coords[0];

I did this long time ago, please check.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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