geocoder issue with recalculating

By kitsguru - October 5, 2014

I would like to see a modication to the code that prompts for overwrite if a value exists and is different from the current value.

Jeff Shields

By claire - October 6, 2014

Hi Jeff, can you open a ticket to get the modified copy of the geocoder plugin?

I'm sure this version will work fine for you. It'll only recalculate the lat/lng if the record is saved with empty lat/lng fields.


Claire Ryan

Save time by getting our experts to help with your project.

By kitsguru - October 6, 2014

If you add a google map api key then the limit is much higher. Starting at roughly line 10 add the key value and then around line 125 update the $url

For a proper mod, the code could be improved by checking that the api key is set

// around line 10

// around line 125
// replace
    $url = "" .urlencode($address);

// with
    $url = "".GEOCODER_APIKEY3."&sensor=false&address=" .urlencode($address);

Jeff Shields

By claire - October 14, 2014

This isn't an official update, no. This is a modified version that I created internally, and I thought may be useful for some people. Dave may decide to add it to the official version though.


Claire Ryan

Save time by getting our experts to help with your project.

Hi Claire,

just to advise that I have now received the amended geocoder, thank you very much, I assume it is just ready to go with the "Do not overwrite if values exist" option already set.

I am not a programmer but having a quick look at the phpcode it looked as though there is the facility to display distance to object from current location, is this something which can be set up without additional software etc and how is it implemented with a summary or detail page generated by cmsbuilder?

Thanks in advance

By claire - October 15, 2014

It is just ready to go, yes.

In theory a geocoder would be able to calculate the distance from the current location to the object, but as far as I know, the code to do so is not present in the plugin. It would require that the current user's lat/lng be supplied in some way, and that isn't available except from mobile devices that allow that information to each website that requests it.

Very doable, but the application is limited because getting the lat/lng from a non-mobile device is not really reliable. Still - what have you got in mind for this kind of functionality?


Claire Ryan

Save time by getting our experts to help with your project.

Hi Claire,

It isnt anything hugely important at this time but as we have a website which provides information on accommodation, businesses and attractions in a holiday location I was thinking that the ability to display business information as we do already but with an added ability to be able to state how far a viewer was from any particular business or attraction or as some applications do, provide directions/google map from the viewers current location to the business or attraction being viewed would be a helpful facility to provide. Perhaps it's something you could look to adding or developing as another plugin if there is sufficient interest from other users.

By Toledoh - October 16, 2014

I've got a couple of sites that collect current location, and use this as the base to then search and display results - by distance.  Great for mobile.

I also saw some time ago, some jquery code that could take start / finish and I think points along the way and display results with routes / time travel by car, walking etc) it was pretty cool.


Tim (

Hi Tim,

That sounds interesting, did you need to purchase additional software to provide that functionality. I am not a programmer so would need to have at  least the basic program/code in place. Do you have addresses for the sites so I can see how it works?