2

I need to OSM map of India having same look and feel as of Online OSM map. I have done following steps for the same :

  1. I have downloaded India map OSM data from below link :

    http://download.geofabrik.de/asia/india.html - >india-latest.osm.pbf

  2. Exported this osm pbf file data in postgis DB using osmosis. so, below are the tables generated in DB :

    actions, nodes, relation_members, relations, schema_info, users, way_nodes, ways

  3. I tried to publish these tables as vector layer in geoserver. however, it doesnt display anything.

So, please suggest me the next step/correct me if I am doing anything wrong.

My final goal is to get offline map of India (without internet), which looks same as of online OSM map.

Based on other posts I tried using tilemill/mapbox. however, I am not clear about the imported India Map data in Postgis+tilemill/mapbox relation. And, the relation between tilemill/mapbox + geoserver.

I am implementing GIS solution using Geoserver+PostGIS+Openlayers technologies.

3 Answers 3

5

If you want to use a postgis database with Openstreetmap data, you have to populate it with osm2pgsql, not osmosis.

That is the only way to get polygons out of Openstreetmap multipolygon relations and closed ways in a format that GIS software can understand.

Alternatively, you can use GDAL ogr2ogr to save OSM data into a spatialite database.

Once you have the data in a database, you have to create rendering rules that look the same as the official Mapnik renderer uses. But that is worth another question.

It might be easier (and faster to display) to get tiles from Mapnik, tilemill or maperitive, and use them as a local openlayers datasource.

6
  • Thanks AndreJ. I will try with osm2pgsql. Parallel, i will try using tiles from tilemill. however, i need to do some research about that tiles approach. May 4, 2015 at 13:37
  • This docker image may helps you registry.hub.docker.com/u/dkiselev/nik4web There are postgis osm2pgsql mapnik (with default style) and some other tools preinstalled there. May 5, 2015 at 6:54
  • Hi Andrej, I have successfully migrated data India OSM data in PostGIS using osm2pgql and below tables are generated :planet_osm_line,planet_osm_nodes, planet_osm_point,planet_osm_polygon,planet_osm_rels,planet_osm_roads, planet_osm_ways ....now what will be my next steps ?? geoserver vector layers doesnt look like actual OSM May 12, 2015 at 18:34
  • You need the point, line and polygon tables.
    – AndreJ
    May 12, 2015 at 18:38
  • @Andrej, I have published the point,line and polygon tables as vector layer using Geoserver. However, it luks very dull compare to online OSM. I have used online sld available for osm map..however, it doesnt look proper as online osm. so, Am I missing any step here ?? or is there any other way?? I want to use osm map as base layer. May 12, 2015 at 18:52
2

I would suggest another approach. If you do not need vector data only OSM as a base map which looks the same as http://www.openstreetmap.org maybe you could create your own OSM service using Mapproxy. I know it is not perfect, but maybe you could give it a try.

First you need to install Mapproxy. Pre-seed all zoom levels of OSM for particular area and then later serve them as a local WMS/TMS service. Mapproxy will locally cache all tiles from OSM for the desired area for later use. You can find several OSM Mappoxy configurations on the internet.

This way you avoid all the problems with data import and data styling in Geoserver. It is possible it style OSM data with Geoserver SLD (example1, example2, example3) but maybe this approach is easier for your use case.

3
  • Hi Mario, i have successfully moved osm data in PostGIS using osm2pgsql. However, when i tried to publish this data as vector layer using Geoserver SLD(from the link u given above) doesnt look good.So, is there any other way to use OSM PostGIS data to display map looks similar to Online OSM ?? May 12, 2015 at 18:44
  • i have not used those style in production only for testing and it was a few years ago but i remember that polygons and lines were more-or-less rendered ok, but points were missing or incomplete. Maybe something changed in the meantime. So i can not give a straight answer why it isnt the same as OSM. I am sorry. Currenty I am using Mapproxy combination in production. I have connected Mapproxy to the OSM and then i connect Geoserver cascading WMS to the Mapproxy. I lose image quality that way but it doesnt matter much to me. May 13, 2015 at 6:40
  • I tried using tile rendering from tilemill... however, while displaying in tilemill the osm data is not looking as real osm map.. May 14, 2015 at 18:11
0

use QGIS

  1. Open the map file by ََQGIS

  2. Select the items map by type

  3. style the items one by one

see the tutorial here

Your Answer

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

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