Search code examples
openlayersshapefilegeoserverproj4jsmercator

Mercator projection world map with Geoserver and Openlayers


I'm trying to render a world map shapefile on my Geoserver with a Mercator projection. I've tried declaring the SRS on Geoserver and defining EPSG projections of 3785 or 900913 in Openlayers with no success. I've also tried to reproject the shapefile using ogr2ogr but the result is slightly off.

Original:Original

Converted: alt text

Here's the command used:

ogr2ogr -t_srs EPSG:3785 target.shp source.shp

I'm new to this technology & mapping concepts. Any pointers would be greatly appreciated!


Solution

  • The geoserver pointer for this is continuous map wrapping.

    In geoserver 2.0.1+ and above this problem can be resolved by starting geoserver with the following JVM options:

    -DADVANCED_PROJECTION_HANDLING=true -DUSE_STREAMING_RENDERER=true
    

    In the upcoming geoserver 2.1.X, this settings are turned on by default.

    example image of a map projected in epsg:900913

    http://2.bp.blogspot.com/_0_xIiXP5xuY/S34-EuJPxAI/AAAAAAAAAKQ/Ez1_aMsRcHg/s1600/continents_900913.png

    more info: http://geo-solutions.blogspot.com/2010/02/geoserver-continuous-map-wrapping.html