Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm trying to use Openlayers and Mapserver to display a shapefile. My HTML file is as follows:

<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">

    var map = new OpenLayers.Map('map');    
    var googleLayer = new OpenLayers.Layer.Google('Google', {type: google.maps.MapTypeId.SATELLITE});

    // Create WFS layer
    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_1.map&",
               featureType: "MLSOA",
               featureNS: "http://mapserver.gis.umn.edu/mapserver",
               srsName: "EPSG:27700",
               version: "1.1.0", 
               PropertyName: "NAME" //also tried "FID"
           })
       });

    //add layers
    map.addLayers([googleLayer,wfsLayer]);

    // Set initial center location
    map.setCenter(new OpenLayers.LonLat(-0.13, 51.55).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()),5);

</script>
</body>
</html>

This loads a google-map base map, and should overlay a shapefile over all of England. When the page loads the coordinates of the bounding box of the map are sent to MapServer. I can see that it is sending just the lon/lat values. In my mapfile, I have the projection of the data defined as follows, in both the intro part, and also in the layer:

 PROJECTION
    "init=epsg:27700"
 END

However, the response from the server gives me an error WFS server error. Invalid or Unsupported FILTER in GetFeature, and I don't know whether it is due to an incorrect bounding box, or whether I have a mistake with my query using PropertyName. From searching online this appears to have been a bug, but I don't know whether it is still a problem or not.

<?xml version="1.0" encoding="ISO-8859-1"?>
<ows:ExceptionReport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:ows="http://www.opengis.net/ows" version="1.1.0" language="en-US" 
xsi:schemaLocation="http://www.opengis.net/ows http://schemas.opengis.net/ows/1.0.0/owsExceptionReport.xsd">
  <ows:Exception exceptionCode="InvalidParameterValue" locator="filter">
    <ows:ExceptionText>msWFSGetFeature(): WFS server error. Invalid or Unsupported FILTER in 
GetFeature : &lt;
    Filter ogc="http://www.opengis.net/ogc"&gt;
  &lt;BBOX&gt;
    &lt;Envelope gml="http://www.opengis.net/gml" srsName="EPSG:4326"&gt;
      &lt;lowerCorner&gt;-55.50109375 43.134977942511&lt;/lowerCorner&gt;
      &lt;upperCorner&gt;55.24109375 59.593781185019&lt;/upperCorner&gt;
    &lt;/Envelope&gt;
  &lt;/BBOX&gt;
&lt;/Filter&gt;
</ows:ExceptionText>
  </ows:Exception>
</ows:ExceptionReport>

What do I need to do to fix this? Should I make sure that I am passing a bounding box in epsg:27700 coordinates? Or can Mapserver accept lon/lat and project them into the required coordinate system?


I have asked another question on the same topic recently, but I had a different problem then!

share|improve this question
    
Try to change the strategy to fixed or filter and see if you get any different results. –  CaptDragon Oct 24 '11 at 17:35
    
Would it just be strategies: 'fixed' ? –  djq Oct 24 '11 at 17:51
1  
it would be new strategies: [new OpenLayers.Strategy.Fixed()], –  CaptDragon Oct 24 '11 at 21:06
add comment

1 Answer 1

Those & in the url look suspicious, try without:

 url: "http://mysite.com/mapserv.cgi/wfs?&map=wfs_1.map&",
                                         ^             ^

if it still does not work try to remove only the first one (the one before map=..)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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