Monday 17 September 2018

openlayers 2 - Openlayers2 and Geoserver: OSM/Google Maps and WMS Overlay


I am experiencing projection problems with the following set up:



  • GeoServer with ESPG:4326 based shapefiles (*.shp)


  • OpenJump to edit my shapefiles

  • Openlayers with EPSG:900913 base layers

  • GeoServer provides the shapefiles as WMS to OpenLayers.


Here is my source code:




Openplanning mit Geoserver













It seems that GeoServer is converting from ESPG:4326 to EPSG:900913 internally. Here you can see a sample request for Vienna (which is sent by my OpenLayers application to GeoServer):



http://localhost:8888/geoserver/wms?LAYERS=topp:ma_vienna&SRS=EPSG:900913&TRANSPARENT=TRUE&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&FORMAT=image/png&BBOX=1800244.8899219,6116147.6705496,1839380.6483984,6155283.4290261&WIDTH=256&HEIGHT=256

My problem: the requested file looks distored, as you can see here:


http://i.stack.imgur.com/UcWBQ.png (sorry, I had to post a link again after my edit ...)


In case I open the WMS layer in the OpenLayers preview of GeoServer, it looks OK:


http://i.stack.imgur.com/P8IMj.png (sorry, I had to post a link again after my edit ...)


The question is: Why is my shapefile distorted in my OpenLayers application, but not in the GeoServer preview? As you can see, the GeoServer preview uses EPSG:4326 and my OpenLayers application EPSG:900913 (Update: EPSG:4326 as well; mouse coordinates are displayed as latitude/longitude). But, however, as GeoServer provides a WMS interface with EPSG:900913 capabilities, shouldn't it correctly reproject my vector sources?




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...