layers don't match on OpenLayers

المشرف العام

Administrator
طاقم الإدارة
So in my Openlayers 3.9.0 I use Bing Maps and OSM layers, they both are EPSG 3857

var layer = new ol.layer.Tile({ source: new ol.source.OSM({}) }); var bingMapsAerial = new ol.layer.Tile({ source: new ol.source.BingMaps({ key: '////', imagerySet:'AerialWithLabels' }) }); I set the extent that the layers mast fit in

var textent = ol.proj.transformExtent([2297128.5, 4618333, 2459120.25, 4763120], 'EPSG:900913', 'EPSG:3857'); I also set a layer from PostGIS

var ait = new ol.layer.Tile({ extent: textent, source: new ol.source.TileWMS({ url: 'http://localhost:8080/geoserver/mymap/wms?', params: {'LAYERS': 'mymap:polygon, mymap:line', 'TILED': true, 'VERSION': '1.3.0','FORMAT': 'image/png' ,'CRS': 'EPSG:3857'}, serverType: 'geoserver' }) })My view is

var view = new ol.View({ center: center, extent : textent, zoom: 6, maxZoom:20});and my map

var map = new ol.Map({ target: 'map', layers:[bingMapsAerial, layer, ait], view: view});map.getView().fit(textent, map.getSize()); The raster tile layer is in EPSG 900913 in PostGIS and Geoserver says EPSG:900913 as Native SRS and Declared SRS. Both polygon and line layers that compose the tile layer have slightly different Native Bounding Box and Lat/Lon Bounding Box, but they render the same spatial region.Both polygon and line layers have Published zoom levels and Cached zoom levels set to 0 -20 in Geoserver to match the Openlayers View settings

Aren't EPSG 900913 and EPSG 3857 supposed to be the same?

Both Bing and OSM layers look ok, but the tile layer appears smaller than the other two.

How do I proceed? Am I missing something, a setting or var? Is there a hack? I have to convert the PostGIS data?

Thanks



أكثر...
 
أعلى