8

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?

5 Answers 5

5

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.

4
  • Is it really done by calculating centroids - in reality? ... You're right about labeling, but that wasn't the question.
    – underdark
    Commented Feb 7, 2011 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
    Commented Feb 8, 2011 at 3:44
  • Don't you mean small and medium scales? (world map = small scale, city map = large scale)
    – Sean
    Commented Feb 8, 2011 at 17:52
  • @Sean yeah, typo from rewriting; thanks for the heads-up
    – scw
    Commented Feb 8, 2011 at 18:49
3

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).

1

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

0

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.

0

Here at Geocode.Farm, we have the boundary data stored and then use an algorithm that ties to create a square or circle (depending on shape of boundaries). The center is then calculated and that is what we use for the coordinates returned.

Disclaimer: I work for Geocode Farm

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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