开发者

Display Map like OpenStreetMap

开发者 https://www.devze.com 2023-01-09 14:52 出处:网络
I like the way OpenStreetMap display its map. It almost looks like Google Map. I have already installed GeoServer and PostGis on my notebook. I also got this cloudmade osm file for my country, Indones

I like the way OpenStreetMap display its map. It almost looks like Google Map. I have already installed GeoServer and PostGis on my notebook. I also got this cloudmade osm file for my country, Indonesia. I downloaded indonesia.osm.bz2. 开发者_运维技巧

I successfully imported it into my PostGis and did setup it on my GeoServer but it didn't display map same like OpenStreetMap. I chose planet_osm_polygon as my layer in GeoServer. At the end, I got this one displayed with openlayers. alt text http://deerawan.com/blogimages/map_polygon.jpg

But I expected to be like this one alt text http://deerawan.com/blogimages/map-indo.png

was it wrong OSM file that I used from Cloudmade?

Thank you for your help.


I would recommend to follow this tutorial from Geoserver blog.

There you'll find a step by step guide on how to setup OSM data, including database import, styling, etc.


The file you download contains just data. No information about the way it's displayed…

You got 2 solutions: - Use OSM directly in your map with a OpenLayers.Layer.OSM ( http://openlayers.org/dev/examples/osm.html ), - Use a cartographic server to style your data the way you want… (OSM uses mapnik, or you can use mapserver : http://trac.osgeo.org/mapserver/wiki/RenderingOsmData , no idea if they're available styles for geoserver )

HTH,


GeoServer requires two things to render a map:

data

Just importing the OSM planet dump isn't enough to get a nice map, you need more than just roads and landmarks. OpenStreetMap adds a coastline dataset (which I think is actually derived from OpenStreetMap data, but pre-processed a bit for performance reasons) and some data from the Natural Earth project.

stylesheets

GeoServer uses the OGC SLD format for styles, so you'll need to find or create some SLD styles specific to the OpenStreetMap dataset. Here are a few suggestions of places you could look for them:

  • OpenStreetMap SLDs used on the OpenGeo OSM demo
  • OpenStreetMap in a box also includes some tools for keeping OpenStreetMap data up-to-date
  • OpenStreetMap tutorial on the GeoServer blog

I'm also working on a tool to convert Mapnik map files to GeoServer configurations. It works okay with the styles from MapQuest Open but still has some issues with the ones used for openstreetmap.org. If you want to give it a try though, bug reports are welcome.


I think that you are missing the coastlines and world boundaries. There is more information on the osm wiki about where to download the additional data to draw the coastlines.

0

精彩评论

暂无评论...
验证码 换一张
取 消