NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Hi,

I installed a local osm tile server follows "https://wiki.debian.org/OSM/tileserver/jessie" instructions.

So, I have a mapserver on "http://localhost/osm_tiles/0/0/0.png" site.

I visualized my map with LeafletJS, it's works fine.

My question: if I positioning my map to a point (lat/long coordinates) how I get this point local info (city name, street name etc...) ?

How do I reverse geocoding from my system? (I don't want to do it from outter source)

Thanks for your answers.

Ps.: sorry for my bad english...

asked 24 Mar '16, 07:11

Leslie%20Gal's gravatar image

Leslie Gal
16112
accept rate: 0%


You will have to set up a Nominatim server for address search and reverse geocoding. Check out http://wiki.openstreetmap.org/wiki/Nominatim/Installation for detailed instructions.

permanent link

answered 24 Mar '16, 08:13

jot's gravatar image

jot
511710
accept rate: 9%

edited 24 Mar '16, 08:14

Thank for your answers Frederik and jot. Both answers is perfect for me. One-one green pipeline to you! Thanks again.

(25 Mar '16, 07:15) Leslie Gal

Installing your own Nominatim instance with a separate copy of the data is the best way to do it. However if you only use it occasionally and you don't mind a small performance penalty you can also hack together a few PostGIS queries that will give you the nearest street, city and so on from a normal rendering database, for example to find the nearest street to a point with the coordinates mylat,mylon you would do something like

SELECT highway,name
FROM planet_osm_line
WHERE highway IS NOT NULL
AND ST_DWITHIN(way, ST_MAKEPOINT(mylon, mylat), 300)
ORDER BY ST_DISTANCE(way, ST_MAKEPOINT(mylon, mylat))
LIMIT 1

or to find the city boundary that contains the point,

SELECT name
FROM planet_osm_polygon
WHERE boundary='administrative'
AND ST_CONTAINS(way, ST_MAKEPOINT(mylon, mylat))

You might have to wrap the ST_MAKEPOINT in a ST_SETSRID(..., 3857) or ST_SETSRID(..., 900913) depending on your setup.

permanent link

answered 24 Mar '16, 08:40

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×85

question asked: 24 Mar '16, 07:11

question was seen: 7,574 times

last updated: 25 Mar '16, 11:10

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum