I need to create a local reverse geocode service for my specific country using open source maps.
My first option is OpenStreetMap so I downloaded my country PBF file.
Can anyone give any idea on how to start using this data? or other options?
There are already various search engines for OSM available. The most popular one currently is Nominatim. It supports both geocoding and reverse geocoding.
Well, you could start of by reading the wiki, I guess it would be interesting to find out which node / way / relation tags you would use as an input. Apart from that you should have an understanding of the best data structures for the task, I guess you want to perform nearest neighbor queries, so you might need to implement / use an R-Tree for that...
Related
I don't know if my question is valid or not,I use nominatim search engine but it can't make auto-complete search so I decide to use pelias by mapzen, my question is that is it possible to import data from nominatim to pelias? How?
Thank you
If you're running a local instance of Pelias you'll need to run the Pelias OSM data importer to index all the venues and addresses in OSM. Pelias uses elasticsearch so it won't work with Nominatim's database as-is.
Not answering your question about pelias but instead the one about Nominatim and auto-completion.
Take a look at Photon. It supports auto-completion and as far as I know it uses a regular Nominatim database. I've never used it myself though.
It might be also worth to look at other OSM-based search engines / geocoders.
I am new in OSM but now I need create application which will use GIS (Geoserver) and will be provide service to get road from point A to point B.
I found some informations about this but I still have any questions.
My is download open street maps and extract to database (PostgreSQL), and for routing use plugin pgRouting. Next connect db to map server and provide api for clients.
Questions:
1. Is that correct way?
2. How osm format could I use for postgre? (osm.pbf? shp.zip?, or something else?)
Thanks for answers
Let me elaborate, what things needed to start till end:
First you need to download, OSM data, for which you can simply use Overpass API.
OSM2PO JAVA based CLI tool to convert OSM data into routable data, here is the good guidline how to use this tool.
Postgresql with postgis and pgRouting extensions, you will use dijkstra algorithm to get shortest route, or any other algorithm that best suits you.
Finally you will need Geoserver, that will provide OGC standards e.g. WMS and WFS, through which you can get your route in raster or vector format, you can store your table as layers and you may need a SQL View.
Further, for front end you can use OpenLayers, which is a JavaScript Web Mapping Library or you can use Leaflet,
You can easily do WMS and WFS requests from these libraries to Geoserver and Geoserver will send you a response, with your requested data, if request is correct.
NOTE: You can use QGIS v2 with pgRouting plugin for testing.
Does OpenStreetMap just provide GIS data? To render maps and have a browser based UI to show maps with data, would a developer need to use something like Mapnik?
OpenStreetMap provides data yes, and you'll need specific tools to make map with them. You first need to put the data in a true GIS format, which OSM is not. Think about PostGIS, an osm2pgsql tool is designed for that. Then, you'll need a rendering tool, i.e. a cartographic engine. You can use Mapnik or MapServer. Tilemill or Kosmtik can help you designing your map styles.
Take a look here.
yo can export data form OpenStreetMap and render your own map.
Take a look at
http://www.slideshare.net/jones139/rendering-openstreetmap-data-using-mapnik
http://www.slideshare.net/artemp/mapnik-sotm-2007
There's a fuller list of rendering libraries for OpenStreetMap data here, both free and commercial.
http://wiki.openstreetmap.org/wiki/Renderer
Disclosure: I am the developer of one of them.
OpenStreetMap provides map data out to a wide sprawling ecosystem of different downloads and tools offering developers different map-making and map using possibilities. Here is a diagram I drew which captures some of this:
So the data comes out of the core of OpenStreetMap, in the form of 'planet downloads', one big unwieldy blob of XML (and diffs), but from there it fans out into a range of other offerings to developers, many of which are provided by 3rd parties. Taken together "OpenStreetMap & Friends" provide lots of possibilities.
If you are inclined to run your own rendering system, then yes, Mapnik is a good choice. Powerful and scaleable (most successful OSM tile servers run Mapnik), but takes a bit of setting up. You normally load OSM XML data into PostGIS, and run mapnik from that (tutorials on switch2osm.org)
If you are not inclined to run your own rendering system (for more lightweight web development tasks this seams reasonable!) you don't have to! You can configure LeafletJS or OpenLayers or others to fetch map tiles from a tile server run by somebody else. There are many providers. See the providers list on switch2osm.org and the Tile Servers list.
I am playing around a bit with openstreetmap data.
What I want to get is the closest "road" (i.e. way with tag 'highway' set to certain values) to the users position.
At the moment I use the API to query all Objects in a square around the user and then parse all the way elements, check their tags, check their distance to the user and so on
But that doesn't sound to elegant to me.
Is there a better solution ? maybe through the API or by installing the openstreetmap data in a local DB somehow to be able to query that directly ?
would be great if someone could point me to the right direction.
Thanks in advance.
please use "Read-Only Data APIs" for getting Data.
You must not use the "editing API" for read-only purposes or projects.
(see Terms of use)
For your purposes I would use OSM Server Side Script
I want to get zip code from users current location(Latitude, Longitude), I had used MKReverse Geocoder delegate methods, but sometimes I am not able to get zip code information based on latitude & longitude (valid values). Are there any other alternatives for MKReverseGeocoder ? ZipCode database are specific to countries, that's why I don't want to use them. Any other idea or clue?
Thanks
Consider the GeoNames web service. It's a complete geocoding/reverse geocoding suite under a Creative Commons attribution license. You can either download their data, or hit their web service. The best thing is, they don't require any API keys or licensing silliness--you just hit their web app and bang you got data.
Here's an example: http://ws.geonames.org/findNearbyPostalCodesJSON?formatted=true&lat=36&lng=-79.08 That'll return you a JSON object for the zip codes around the Chapel Hill, NC area.
It's also international. Here's Seaford, England, and the only difference is the lat/lng pair I'm sending: http://ws.geonames.org/findNearbyPostalCodesJSON?formatted=true&lat=50.5&lng=0.08
Then you need to learn to make web requests and parse JSON (if you don't already have a grip on those things), and you're all set.
This is actually a tricky question. Using a geocoding solution like GeoNames is likely to lead to major errors for a lot of queries. The reason for this is that GeoNames by looking up the record in their database that is closest to your query point and then returning the ZIP code they have on record for that point. This works great when your query point is right on top of a record in their database, but can lead to errors otherwise. For example, if their nearest record is a few blocks away in a different ZIP code, you'll get the wrong answer.
The US Census Bureau has created maps of the ZIP codes:
https://www.census.gov/geo/reference/zctas.html
Please see their notes on that page.
I have also worked on a project that uses the Census maps to provide an API that gives back the ZIP code for a given latitude and longitude. It is at:
http://askgeo.com
We offer both a web API and a Java Library that you can run on your own server. The library has excellent performance. Since our site offers additional information than just the ZIP code, you can read about our ZIP code service here:
http://askgeo.com/database/UsZcta2010
And you read about the documentation for the Web API here:
http://askgeo.com/#web-api
The GeoNames methodology is fundamentally flawed for this type of query. If you are looking for the polygon that contains a given query point, you need a map with the polygons, and you need a spatial index to provide fast look-ups. GeoNames has neither. AskGeo has both.
If you have a free db (available from that site? Just search for zip code database and you'll see it)
then you can run an internal SQL query testing for nearby lat/longs. That way you won't need to worry about licensing a web service.
You have three options then. SQL BETWEEN statement, the hypotenuse equation, or Haversine. Haversine being the best, luckily it's tutorial'd elsewhere
EDIT:
Couple of other options I've seen recently:
http://developer.yahoo.com/geo/placefinder/guide/index.html
http://jamiethompson.co.uk/projects/2010/04/30/an-open-free-uk-postcode-geocoding-web-service/
http://www.postcodeanywhere.co.uk/geocoding-service/api.aspx
--
Take a look at the Google Maps API - Reverse Geocoding (only useful if embedding results in a Google Maps interface).
Sample code here:
Get Zipcode from results[1].formatted_address
https://developers.google.com/maps/documentation/javascript/examples/geocoding-reverse