Closed (fixed)
Project:
Location
Version:
5.x-1.x-dev
Component:
Data update
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
30 Mar 2007 at 18:21 UTC
Updated:
12 Nov 2011 at 01:32 UTC
Jump to comment: Most recent file
Is there a reason that (in the absence of other working service-providers) google maps call isn't used as fallback for _all_ addresses worldwide?
I know it does work for germany and austria ... no use to write the same function over and over again for all countries.
In the presence of the gmap module we could even reuse the apikey used there.
If there's no reason, I can come up with a patch to make it so ;-)
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | location.fr_.inc_.txt | 637 bytes | BobLouis |
| #15 | geocode_google.inc_.txt | 2.23 KB | BobLouis |
| #1 | location-geocode-google-refactor-1.patch | 12.81 KB | ray007 |
Comments
Comment #1
ray007 commentedSince there were no replies I decided to go a slightly different route for now.
The attached patch
- introduces a new file
supported/geocode_google.inc- defines function
location_geocode_google()andlocation_geocode_google_settings($cc = NULL)in there- calls those 2 function for the specific function for 'us' and 'ca'
- adds similar code to provide geocoding and maplink with google for countries 'at' and 'de'
I think we need to define a "global service provider" that can be referenced from several countries, but this solution is good enough for me for now.
Comments?
Comment #2
ray007 commentedchanged status and renamed issue to more proper title
Comment #3
ray007 commentedIs there anything wrong with my patch?
I had been hoping for some feedback ...
Comment #4
nicolash commented+1 for this. Gmaps is by far the most widely adopted mapping and geocoding service outside of the US...I believe pretty much all of Europe and certainly Australia are included...not sure about Asia.
Comment #5
BachusII commentedYou can add 'nl' to the list of countries which can be geocoded by google.
Comment #6
JohnG-1 commented+1 AFAIK google maps is currently the best option. It makes sense to run with this until a better service appears, and then switch over to that one! Internationalisation of location.API is long overdue. Nice one Ray :)
Comment #7
ray007 commentedis there anything I can do for this patch to be considered for inclusion?
Comment #8
Ian Ward commentedThere are limitations with just using google, so maybe finding a clean way to allow for failovers would be good too. I write about the shortcomings of using just any one service over here - http://www.developmentseed.org/blog/geocoding/geonames
Ian
Comment #9
ray007 commentedI do not doubt that a solution allowing the use of arbitrary geocoding-services would be preferable, but
- google seems to work for most situations where there's nothing working out of the box now
- i have a patch making it work with google right now
those of you living in the usa or canada may not feel the lack of a solution covering the rest of the world, but the rest of the world does ...
Comment #10
BobLouis commentedRay, it seems that your patch is exactly what I needed, but for France (I was looking here before: http://drupal.org/node/147037).
How should I proceed to implement your patch? Does it work like this? Or do I have to replace "de" for Germany, by "fr" for France for example in your patch?
Thank you anyway for the job!
Comment #11
ray007 commentedcopy one of the country include files to location.fr.inc and change everything in the file that looks like the country code to 'fr'. remove the province list (if there is one) or write one for france and chances are pretty good it will work then ;-)
Comment #12
BobLouis commentedWhat I did:
- applied your patch, which created a "geocode_google.inc" file that I copied to the "modules/location/supported/" directory.
- already had a "location.fr.inc" file in that directory
What do I need to do next to get geocoding working ?
Comment #13
ray007 commentedlook at the file
location.at.incYou will probably copy over and adapt to country code 'fr' the following functions:
- location_map_link_*
- location_geocode_*
don't forget to
require_once('geocode_google.inc');and see what happens ;-)Comment #14
ibnhafsun commentedIt works with Spain but not the proximity searches.
Any suggestions? Does proximity search work with other countries (at, fr, de, nl)?
Comment #15
BobLouis commentedRay, I done what you said ;)
Now I have the following error message at the top of the submit form when trying to add a location enabled event:
Would you have time to look at them, I attach:
- geocode_google.inc (I added "txt", uploading "inc" files is not allowed), since I am not sure to have performed the patch correctly
- location.fr.inc. (in the next comment)
Thank you anyway for your instructions.
Comment #16
BobLouis commentedand here is "location.fr.inc"
Comment #17
ray007 commentedyour location.fr.inc file seems completely broken.
re-create it again starting from location.at.inc (or one of this others using google_geocode.inc)
Comment #18
BobLouis commentedI applied the patch from my PC (windows) and uploaded the results to my host. For some reason, patching from my PC didn't work properly (although I used Unxutils as explained here : http://drupal.org/node/60179).
Then I tried to apply the patch directly from my host, using Putty. And it worked !
So thank you very much for your help Ray!
Just one question now: is there a way to display the map associated with the node instead of a "See map: Google Maps" link (the map is only displayed in the node for addresses in the US)?
Comment #19
ray007 commentedI have work in progress on a gmap cck field (see http://drupal.org/project/gmap_addons) and location-integration is on my list of things to do ... but will take some time.
Comment #20
sivasamba commentedHello Im french Bob Louis.
And I would like to do the same thing like you. I can not geocode mi adresses?
What should I do?
Thanks a lot
Comment #21
TimDavies commentedOnly just spotted this thread.
I wrote a patch a while back which makes use of the Geonames service as a fallback:
http://drupal.org/node/75459#comment-216146
It seems to work pretty well for me for most countries (although with more accuracy in some than others...)
It could be adapted to also use Google Maps where geonames doesn't provide a suitable response, or vice-versa.
Tim
Comment #22
ray007 commented@obscurity:
Yes, I've already seen this thread.
As I already wrote in another comment, I think we need to introduce the concept of "global geocoding services", and those have a list of countries they support. But until we get word from the maintainers about what changes they'd accept I'll happily live with using google for the countries I need. Seems to work well enough so far.
Comment #23
ankur commentedI've actually been looking at the patches on this thread over the last month or so and been using them to write something similar. I should have something similar up soon (i.e., within the next week or two).
-Ankur
Comment #24
nashINATOR commentedHey Ray!!
Your patch looks unbelievably awesome. But I have a problem, a severe handicap. I am a noob!!! I cant seem to figure out how to patch or implement the patch.
Someone please help!!!
Cheers
Nash
Comment #25
nashINATOR commentedAfter much internal debate, and the admission to not knowing any php (limited php rather) i decided to look at the code for my self.
Well I took the us file and restructured it for nz. It works. The geocoding i mean but thats as far as it gets. I cant seem to get google maps to get the location information and display a map in the node. Maybe i need to understand the google maps module better. On the other hand i got it to work with the see map links module. (which means it opens in a new page and at the google website).
I would be eager to get some help re displaying a map within the node that gets map data from location module.
Cheers
Nash
Ps: if anyone requires the code for customising location to geocode your location contact me and i will fill you in. Basically what is to consider is does maps.google.com know where you are? Yes? then it will work. Oh! and i got my locations module to work for New Zealand
Comment #26
ankur commentedI've committed a fix for this issue. Google geocoding now takes place in only one function and you only have to enter a Google API key once. I will also look into adding additional countries for which Google Maps has recently begun offering geocoding web services. ray007 and BobLouis, thanks for your patches.
-Ankur
Comment #27
(not verified) commentedComment #28
rich86 commentedHi, I'm sorry to reopen this issue but I'm slightly confused about its status. I tried using the file at the top of this page but it doesn't seem to provide any geocode details for uk data.
Comment #29
summit commentedSUbscribing. I have the same behaviour as stated for uk data. But for me it is Spanish dat which is not provided.
Greetings,
Martijn
Comment #30
raymondllee commentedSubscribing, I have the same issue as #28 for UK addresses
Comment #31
bdragon commentedChanging component to Data update.
Comment #32
catchWhole bunch of geocoding issues marked as duplicate of this one: http://drupal.org/node/66887
Comment #33
scott.mclewin commentedsubscribing. We do essentially this with a bespoke patch for www.folkjam.org and would really like to have a google geocode fallback for all locations.
Comment #34
yesct commentedwhich should be the master discussion of geocoding?
this or #66887: Better geocoding support?
Comment #35
yesct commentedrelated to #175193: Zip code database out of date
Comment #36
yesct commentedmarked
#75459: integrate geonames location webservice - 6 million geographic locations and growing!
as duplicate of this one
look into:
#301275: Improvement to google.inc geocoding - use CSV instead of XML
#301539: freeform entry
related:
#431912: Geocoded address option for proximity views filter
#282202: Bulk geocode
Tagging.
Comment #37
yesct commentedrelated to
#255218: Cooperate with the Google Client Geocoder module guys
#132541: refactor google geocoding
#320107: Long/Lat not being created when apartment number is included in "Street" field
Comment #38
yesct commentedrelated to #346040: Geocoding Not Working - user interface weirdness when both GMAP and "Use a Google Map to set lat long" is enabled (user interface bug/improvement request)
Comment #39
cyberwolf commentedSubscribing.
Comment #40
ankur commentedLooks like this was done a while back. Users now only need to enter their key once.