[OpenLayers-Users] Openlayers and Mapserver
David Quinn
daithiquinn at gmail.com
Mon Oct 24 18:30:53 EDT 2011
Hi List,
I'm trying to use OpenLayers and Mapserver as a WFS. I'm having some
difficulty understanding how to deal with projections within the browser and
on the server-side. Within OpenLayers I have the following html:
<html>
<head>
<title>OpenLayers Example</title>
<script src="http://openlayers.org/api/OpenLayers.js"></script>
<script type="text/javascript" src="
http://maps.googleapis.com/maps/api/js?sensor=false"></script>
</head>
<body>
<div style="width:100%; height:100%" id="map"></div>
<script type="text/javascript">
mapOptions = {
projection: new OpenLayers.Projection("EPSG:3857"),
units: "m",
maxExtent: new OpenLayers.Bounds(-715222.69, 6422313.80,
196915.72, 7521021.46)
};
map = new OpenLayers.Map('map', mapOptions);
var googleLayer = new OpenLayers.Layer.Google('Google', {type:
google.maps.MapTypeId.SATELLITE}, {"sphericalMercator": true});
map.addLayer(googleLayer);
// Add WFS data
var wfsLayer= new OpenLayers.Layer.Vector("WFS", {
strategies: [new OpenLayers.Strategy.BBOX()],
protocol: new OpenLayers.Protocol.WFS({
url: "http://mysite.com/mapserv.cgi/wfs?&map=wfs_mlsoa.map&",
featureType: "mlsoa",
featureNS: "http://mapserver.gis.umn.edu/mapserver",
srsName: "EPSG:3857",
version: "1.1.0",
geometryName: "NAME"
})
});
//add layers
map.addLayers([googleLayer,wfsLayer]);
</script>
</body>
</html>
And on my mapserver side I state that my map/data has the following
projection:
PROJECTION
"init=epsg:3857"
END
and extents
EXTENT -715222.69 6422313.80 196915.72 7521021.46
I am assuming that it is ok to use the epsg:3857 code (the equivalent of
epsg:900913) with data projected using ESRI's 'Mercator_Auxilary_Sphere'.
However, I cannot get my bbox to retrieve the data. The shapefile is an
outline of England. When I view the post/get using Firebug I see that the
response is:
<gml:boundedBy>
<gml:null>unknown</gml:null>
</gml:boundedBy>
I saw that this question about changing projections
http://osgeo-org.1803224.n2.nabble.com/wfs-openlayers-non-native-projection-td6146097.htmlwhich
is why I tried to overwrite the default options. I'm not sure what
else to try and would appreciate any suggestions.
Thank you,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20111024/63c77c8e/attachment-0001.html
More information about the Users
mailing list