Skip to content

A collection of utilities that help with the analysis and indexing of geographic data.

License

Notifications You must be signed in to change notification settings

socialsensor/geo-util

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

geo-util

The project currently offers support for two common geocoding operations without the need to install complicated GIS software.

Getting started

You first need to download and store locally at least two files from Geonames.org:

There are two basic classes that you will want to use: ReverseGeocoder and Countrycoder. Both are initialized giving the two above files as arguments to their constructors. Once initialized, you can use the following two methods:

  • ReverseGeocoder.getCountryByLatLon(lat, lon), which given a pair of coordinates returns the country where these belong,
  • Countrycoder.getCountryByLocationName(locationName), which given a location name returns the country where this belongs.

Considerations

Both of the above methods are not expected to always work correctly. This is due to the following. The first one (getCountryByLatLon) is based on a very simple approximation, i.e. returns the country of the closest geographical object in the index (therefore, you should expect better accuracy by using the allCountries file compared to the cities1000). The second method (getCountryByLocationName) simply indexes the location names (incl. alternate names) found in the geonames files and returns the country through a look-up. It does not perform any approximate text matching, nor does it handle name synonymy.

Contact for further details about the project

Symeon Papadopoulos ([email protected])

About

A collection of utilities that help with the analysis and indexing of geographic data.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages