WMS Bad request in OpenLayers 3

المشرف العام

Administrator
طاقم الإدارة
I have used OpenLayers2 in order to show a layer with points from Geoserver. I try now to transform the code from Openlayers2 to OpenLayers3 but I am facing some issues. I have walked through this nice tutorial: OpenLayers3 and I have a good understanding of how to add layers from localhost geoserver in OL2.

This is part of my code:

function init() { map = new ol.Map({ target:'map', renderer:'canvas', view: new ol.View({ projection: 'EPSG:900913', center:[0,0], zoom:5 }) }); var newLayer = new ol.layer.Tile({ source: new ol.source.OSM() }); map.addLayer(newLayer); var vectorLayer = new ol.layer.Tile({ source: new ol.source.TileWMS({ preload: Infinity, url: 'http://localhost:8080/geoserver/gwc/service/wms', serverType:'geoserver', params:{ 'LAYERS':"dSpatialAnalysis:categoriesdata", 'TILED':true } }) }); map.addLayer(vectorLayer); } For some reason I get a:

GET http://localhost:8080/geoserver/gwc...848654,0,3757032.814272982,1252344.2714243277 400 (Bad Request) I understand that somethings regarding the projections have changed in OL3 and I wonder if this is related with the errors I get. I also checked if the layer works correctly. I can view it in the "Layer Preview" of geoserver and it works fine with OpenLayers2. What can it be the issue?



أكثر...
 
أعلى