3

I want to discuss a scenario here to all.

  1. I have developed a Web mapping application in OpenLayers and GeoServer. The customer give us shapefiles with native projection SWREFF99_1330 (EPSG:3008). i published this shapefile on Geoserver after changing its native projection from EPSG:3008 to EPSG:4326 by using ogr2ogr tool. The layer displayed perfectly over Google map layer in my OpenLayers Web Page.

  2. Again, I publish this shapefile on GeoServer with its native projection (this time, without changing projection using ogr2ogr tool) and then i go to my page and figure out that the layer was not visible over Google map layer.

Now, my question to all members:

Is there any way to change the native projection from EPSG:3008 to EPSG:4326 at client side (in my OpenLayers web page code) ? so that the layer should display correctly over google base layer as in case 1.

1
  • The projection can also be done by GeoServer.
    – Sean
    Commented Aug 11, 2011 at 14:40

1 Answer 1

4

You can project in Openlayers like this:

    var map = new OpenLayers.Map("map", {
  projection: new OpenLayers.Projection("EPSG:3008"),
  displayProjection: new OpenLayers.Projection("EPSG:4326")
}); 

Proj4js is required to do this on the client side.

3

Your Answer

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

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