Geocoding via the Maps API - some observations

51 views
Skip to first unread message

Joseph Elfelt

unread,
Dec 10, 2010, 10:42:21 PM12/10/10
to Google Maps JavaScript API v3
Recently I added a ‘search’ feature to my app which uses
google.maps.Geocoder(). The user can tell the app to either (1)
display a map showing the first ‘hit’ returned by Google or (2)
display a list of all the hits returned by Google.

If you want to experiment with the geocoder and see the complete list
of hits returned by Google in response to your search request, then
the link below will open my app with a world map. Click Menu ==>
Search. Note that I have only recently added this feature and based
on user feedback I will be making some tweaks to improve the user
friendliness of this feature.
http://www.mappingsupport.com/p/gmap4.php?ll=38.259207,-16.760195&t=t1&z=2

Since my app particularly targets hikers/climbers, many of my users
will search based on names of mountains or other natural features.
Alas, I have been unable to find any info online with tips for how
best to use the geocoder with names of natural features.

Here is one thing I have learned by trial-and-error. If you search on
a single word plus the name of a political subdivision (state/province/
etc) then Google builds a list of hits that includes your search name
anywhere in the name of the hit. For example, compare the list of
hits that the Google geocoder generates for these two searches:

daniel
daniel wa ((Washington State, also West Australia ))
For the second search the hits include a mountain, a steakhouse and
various roads.

But wait, there is an exception to the above statement. If the name
you searched on is the name of any kind of town, even one that is now
gone, Google will only return the location of that town and will not
return any other hit. For example a search on ‘novelty wa’ only
returns the location of this long-gone settlement. If you do this
search with my app and then change the map view to MyTopo, you will
see the name “Novelty” on the map. I live a few miles away and there
is nothing at that location.

Now search on “novelty road wa’. You will get several hits related to
roads. Yet none of those hits were returned when you searched on
‘novelty wa’.

If anyone else is also experimenting with sending names of natural
features to google.maps.Geocoder(), please share any insights you
glean as to the workings of the geocoder.

geoco...@gmail.com

unread,
Dec 11, 2010, 2:32:26 AM12/11/10
to Google Maps JavaScript API v3
On Dec 10, 7:42 pm, Joseph Elfelt <josephelf...@gmail.com> wrote:
> Recently I added a ‘search’ feature to my app which uses
> google.maps.Geocoder().  The user can tell the app to either (1)
> display a map showing the first ‘hit’ returned by Google or (2)
> display a list of all the hits returned by Google.
>
> If you want to experiment with the geocoder and see the complete list
> of hits returned by Google in response to your search request, then
> the link below will open my app with a world map.  Click Menu ==>
> Search.  Note that I have only recently added this feature and based
> on user feedback I will be making some tweaks to improve the user
> friendliness of this feature.http://www.mappingsupport.com/p/gmap4.php?ll=38.259207,-16.760195&t=t...
>
> Since my app particularly targets hikers/climbers, many of my users
> will search based on names of mountains or other natural features.

The purpose of a geocoder is to turn (mainly postal) addresses into
geographic coordinates. Any other information returned (like
mountains and other natural features) is a bonus and not to be
expected.

> Alas, I have been unable to find any info online with tips for how
> best to use the geocoder with names of natural features.

Have you tried local search? Or you might investigate the Places
API:
http://code.google.com/apis/maps/documentation/places/


-- Larry

Joseph Elfelt

unread,
Dec 11, 2010, 8:35:23 AM12/11/10
to Google Maps JavaScript API v3


On Dec 10, 11:32 pm, "geocode...@gmail.com" <geocode...@gmail.com>
wrote:

> Have you tried local search?  Or you might investigate the Places
> API:http://code.google.com/apis/maps/documentation/places/

Larry, thanks for the suggestions.

Since local search has been deprecated, I am not inclined to go there.

The Places API will not work at all for searches that are intended to
find natural features. The documentation states: "At this time, the
Places API is designed for building applications that need to
determine the Place where a user is located."

By contrast, consider the documentation for the v3 Geocoder API.
http://code.google.com/apis/maps/documentation/geocoding/
About half way down it says:

"Address Component Types
...
The following types are supported and returned by the HTTP Geocoder:
...
* natural_feature indicates a prominent natural feature."

While it is true that my app uses google.maps.Geocoder() and does not
directly use the v3 Geocoder API, I am guessing that behind the scenes
Google is using the same database to service the request. Umpteen
zillion place names are in that database without any actual street
address. For example, use my app to search on 'Denver' and click
'List'. The message displayed by my app includes the 'street address'
returned by Google. Even though there is no street address per se for
this search, Google has no problem returning coords.

Google's database no doubt includes a dump from the feds of all names/
coords in the USGS database. That dataset includes peaks, lakes,
rivers, ghost towns, etc. That is why it is easy to use either
google.maps.Geocoder() or the Geocoder API to search using the names
of things. This could be either the name of a city or the name of a
mountain.

Rossko

unread,
Dec 11, 2010, 11:28:01 AM12/11/10
to Google Maps JavaScript API v3
> Google's database no doubt includes a dump from the feds of all names/
> coords in the USGS database.  That dataset includes peaks, lakes,
> rivers, ghost towns, etc.

I haven't seen anything to suggest that is the case ; even if it were
so, those features may not attract the same priority as possible
answers as a street address might.

>  That is why it is easy to use either
> google.maps.Geocoder() or the Geocoder API to search using the names
> of things.  This could be either the name of a city or the name of a
> mountain.

I thought what you were telling us was that it wasn't turning out to
be easy!
I doubt Google will reveal the subtleties of inner workings, indeed
they may have bought some in and not even be at liberty to disclose.
Much depends on purpose ; example, user searches for "Atlantic".
Should the answer be Atlantic Ocean, Atlantic City, or Atlantic
Boulevard ? The geocoder has to guess what is the more significant
feature. In this context, the docs
http://code.google.com/apis/maps/documentation/javascript/services.html#Geocoding
are pretty clear ;
"Geocoding is the process of converting addresses (like "1600
Amphitheatre Parkway, Mountain View, CA") into geographic coordinates"
So we might expect Google's geocoder to do its best to match up the
rubbish we feed it with an address. As an aside, it might or might
not manage to come up with city or mountain names - but that would be
a bonus, not the primary purpose. Put in short, it is a geocoder not
a gazetteer.

Sounds generally unsuitable for hiking interests to be honest ... have
you looked into the Geonames service ?

Joseph Elfelt

unread,
Dec 11, 2010, 12:36:57 PM12/11/10
to Google Maps JavaScript API v3


On Dec 11, 8:28 am, Rossko <ros...@culzean.clara.co.uk> wrote:
> have you looked into the Geonames service ?

Thanks Rossko. I was unaware of Geonames. I'll look into it.
I can easily see having two search tools in my app. One based on
google.maps.Geocoder() and one based on Geonames.

However I do observe that if a feature is named on the USGS 7.5" topo
map, and you search on the full name of the feature + the state
abbreviation, then in the majority of tests I have made Google does a
good job of giving you the correct hit.

Thanks again for the Geonames tip.
Reply all
Reply to author
Forward
0 new messages