Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

First, a little disclaimer.

I know that I can just call one of any number of geocoding APIs to perform this for me. This is more of a curiosity than anything else.

With that aside, how does someone (like Google) turn a city name into a latitude and longitude? From playing around with Google Maps it appears that most of the time a city is pinpointed to it's downtown area, but there seems to be no reason why one street corner is picked over any other street corner.

I am just curious what algorithm a geocoding service provider would utilize for performing such an action.

I hope that makes sense, and thanks for satisfying my curiosity.

share|improve this question
add comment

4 Answers

up vote 4 down vote accepted

The label placement is often designed to improving map readability rather than being driven by the data directly: often cartographic displacement is performed on the original geometries to improve the legibility of the map. 41Latitude had a great article on city label placement you might be interested in.

The USGS GeoNames aka GNIS (a commonly used public domain gazetteer used by e.g. Geonames.org, Wikipedia, OpenStreetMap) provides this note:

...The guideline for digitizing areal features requires that the primary coordinates be taken in the center, but the location of the center of a large city is sometimes somewhat subjective.

If you were looking to algorithmically choose the center of a city you might use the centroid of a polygon delineating the city limits, or perhaps something more sophisticated like using the center of the alpha shape.

share|improve this answer
    
Is it really done by calculating centroids - in reality? ... You're right about labeling, but that wasn't the question. –  underdark Feb 7 '11 at 23:37
    
Because a city is not a point phenomena, label placement is a common use of a single geocoded location at large and medium scales, and at small scales precision is less important. –  scw Feb 8 '11 at 3:44
    
Don't you mean small and medium scales? (world map = small scale, city map = large scale) –  Sean Feb 8 '11 at 17:52
    
@Sean yeah, typo from rewriting; thanks for the heads-up –  scw Feb 8 '11 at 18:49
add comment

I doubt there is a universal algorithm for this. Geocoding providers buy their address data from some vendor. That vendor - or whoever collects the data - simply decides where the 'center of town' is (based on their knowledge of the area).

share|improve this answer
add comment

The data is from TeleAtlas (in most cases) http://en.wikipedia.org/wiki/Tele_Atlas#Google_and_other_Internet_mapping_agreements though Google are trying to move away from buying data in and doing it themselves. The strangeness of some city geocodes are based on the road network and some automated tool as far as anyone knows

try http://mapinsight.teleatlas.com/mapfeedback/help/demoEN.html

share|improve this answer
add comment

This might not be the answer you are really after, but could be an alternate solution (appraised by statisticians):

If you know the geocodes of some cities and also know the distance matrix among the cities, you could perform e.g. a MDS to compute the geocodes of each city based on the distances. Some geocodes are only required to get the "top" and "bottom" of the map as MDS will draw a really precise map of your cities :)

But back to the question: a really good one! I definitely can compute latitudes and longitudes in a city easily with the help of the geocodes of houses set on the corners of street, but have no exact idea how someone could compute the geocodes of cities without knowing e.g. the distance matrix shown above.

I assume google (and others) just buy the maps from those who have them (as was done in pasty for sure at several places, see e.g.g this article from cnet), or they would have to make those up by traveling all sites which could consume a lot of resources.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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