Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Call Google geocoder from Links

Quote Reply
Call Google geocoder from Links
I have an existing directory with a moderate number of links and I want to add Google Maps. The easiest solution would be to create geolatitude and geolongitude fields and call a routine from inside the detail page that just says if they are NULL, geocode. Then it would use the address info to get the geocoordinates from google.

What's the best way to do this in Links? I already have php code that can do this. Can I call PHP from perl? Or can this be done in a subroutine, or do I need to write a plug-in?

I guess in the worst case I can have an external program just query the database and write the info for the existing data ...

Thanks
Quote Reply
Re: [kerbouchard2] Call Google geocoder from Links In reply to
Hi,

You just wanna show map locations for listings? I have as plugin that does that already:

http://www.ultranerds.co.uk/...sion/GoogleMap_L256/

You can see a nice example of it running here:

http://www.i-do-directory.co.uk/Detailed/176.html

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Call Google geocoder from Links In reply to
Thanks, but I can already display the map. I just need to enter the geocodes manually. I want Links to check for geocoordinates at build time and if they aren't there, call the geocoder, fetch the codes and write them into the database. I don't want to geocode every time somebody looks at the page.


Also I'm running an old version of Links. Version 2.X or something. My implementation is heavily customized and it has the Php front end which is good because the rest of the site is in php too. I don't need any new features so I won't upgrade.


Do you know if it's possible to call the geocoder via a subroutine? Or do I need a plugin? I know that with my version of links I can use the php front end to geocode when listings are submitted, but that doesn't help me for what's already in the database.
Quote Reply
Re: [kerbouchard2] Call Google geocoder from Links In reply to
Hi,

My plugin doesn't grab it EVERY time... only 1 time ;) It then stores the values in a Lat/Lng field ready for use by the plugin.

Quote:
Also I'm running an old version of Links. Version 2.X or something. My implementation is heavily customized and it has the Php front end which is good because the rest of the site is in php too. I don't need any new features so I won't upgrade.

Mmm ok, it may not work using the PHP frontend ... I havn't coded for that (as it was dropped a while back). Your best bet would probably be to do the geocoding upon add/modify functions, when the address values exist. Then assign them to the appropriate fields in your table. I'm not really much of a PHP fan, so afraid I can't help much more than that.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates