https://github.com/wardvanwanrooij/osm-reverse-geocoder
OpenStreetMaps Reverse Geocoder
https://github.com/wardvanwanrooij/osm-reverse-geocoder
osm plpgsql reverse-geocoding
Last synced: 5 months ago
JSON representation
OpenStreetMaps Reverse Geocoder
- Host: GitHub
- URL: https://github.com/wardvanwanrooij/osm-reverse-geocoder
- Owner: wardvanwanrooij
- License: mit
- Created: 2018-04-29T10:41:29.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2021-02-17T15:28:16.000Z (about 5 years ago)
- Last Synced: 2025-02-01T03:13:19.648Z (about 1 year ago)
- Topics: osm, plpgsql, reverse-geocoding
- Language: Perl
- Size: 9.77 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# osm-reverse-geocoder
## Overview
osm-reverse-geocoder is a simple reverse geocoder for OpenStreetMaps. It does not require the installation of Nominatim or other packages, only the imported PostgreSQL database.
Latest version at https://github.com/wardvanwanrooij/osm-reverse-geocoder
## Performance
It takes about 0.2sec to reverse geocode a coordinate on my VPS (uncached, after reboot). You can benchmark your own installation with the included script by reverse geocoding 500 random (though fixed) coordinates in Europe.
export DBI_DSN="DBI:Pg:dbname=osm;host=127.0.0.1"
export DBI_USER="osm"
export DBI_PASS="***yourpassword***"
perl benchmark.pl
(...)
took 98 seconds to process 500 coordinates, 0.20 sec/coordinate
## Installation
Install by loading the reverse_geocoder.sql script in your OSM database:
$ psql osm -f reverse_geocoder.sql
CREATE FUNCTION
$
Installation requirements are:
* Tags must be present in the database (--hstore option in osm2pgsql)
* OSM import must be done in the default coordinate system (EPSG:3857)
## Usage
Invoke the reverse geocoder by calling the reverse_geocode function with latitude and longitude (in WGS84) as parameters:
osm=> SELECT * FROM reverse_geocode(52.380021, 5.195351);
country_iso | country | city | street | housenumber | distance
-------------+-----------------+--------+-------------+-------------+------------------
NL | The Netherlands | Almere | Sesamstraat | 32 | 8.68894216514979
(1 row)
osm=>
Any or all return values can be NULL.