2

I have read and tested all the relative posts but I still don't have a solution for my problem.

I have a layer suscribers (points) stored in PostGIS database with srid=32232. I would like to display the layer in OpenLayers in geographic projection EPSG:4326. I can see the response with Firebug but get no display.

My code:

map file

MAP 
  IMAGETYPE PNG 
  EXTENT -180 -90 180 90 
  UNITS DD 
  SIZE 1500 650 
  IMAGECOLOR 255 255 255 
  FONTSET "fonts/fonts.list" 
  SYMBOLSET "symbols/symbols35.sym"
  WEB 
    IMAGEPATH "tmp/tmp_img/" 
    IMAGEURL "**/guide/tmp/tmp_img/" 
    HEADER "query_header.html" 
    FOOTER "query_footer.html" 
    METADATA
      "wfs_title" "WFS Guide" ## REQUIRED
     "wfs_onlineresource" "http://*********/cgi-bin/mapserv.exe?" ## Recommended
     "wfs_srs" "EPSG:4326" ## Recommended
     "wfs_abstract" "This is the wfs service of guide" ## Recommended
     "wfs_enable_request" "*"  # necessary
    END
  END
  PROJECTION 
    "init=epsg:4326" 
  END
  LAYER # suscribers begin here 
    PROJECTION 
     "init=epsg:32232" 
    END 
    METADATA 
      "wfs_title" "suscribers" ##REQUIRED 
      "wfs_srs" "EPSG:4326" ## REQUIRED 
      "gml_include_items" "all" ## Optional (serves all attributes for layer) 
      "gml_featureid" "gid" ## REQUIRED 
      "wfs_enable_request" "*" 
    END 
    CONNECTIONTYPE postgis 
    NAME suscribers 
    CONNECTION "user=postgres dbname=postgis20 password=pass" 
    DATA "geom FROM public.suscribers USING UNIQUE gid USING SRID=32232"
    STATUS ON 
    TYPE POINT 
    DUMP TRUE
  END # suscribers ends here
END # end of map

openlayers

var map = new OpenLayers.Map('map',
    { controls: [], 
      allOverlays: false, 
      tileSize: new OpenLayers.Size(100, 100),
      maxExtent: OpenLayers.Bounds.fromString("-180,-90,180,90"),  
      projection: new OpenLayers.Projection("EPSG:4326"), 
      displayProjection: new OpenLayers.Projection("EPSG:4326") //mouse position }); 
var basic = new OpenLayers.Layer.WMS("Basic",
    "http://vmap0.tiles.osgeo.org/wms/vmap0", 
    { layers: 'basic' },
    { singleTile: true,
      ratio: 1,
      transitionEffect: 'resize', 
      opacity: 0.5
    }
 );
var wfsSuscribers = new OpenLayers.Layer.Vector("States",
    { protocol: new OpenLayers.Protocol.WFS(
        { url: "http://*********/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/routing/index.map&",
          featureType: "suscribers",
          featureNS: "http://****/routing"
        }),
    projection: new OpenLayers.Projection("EPSG:4326"),
    strategies: [new OpenLayers.Strategy.BBOX()]
    }
);
map.addLayers([basic, wfsSuscribers]); map.zoomToMaxExtent();   
map.setCenter(new OpenLayers.LonLat(11.52, 3.83), 3);

response

<gml:boundedBy>
    <gml:Box srsName="EPSG:4326">
        <gml:coordinates>11.416136,3.714272 11.554812,3.969178</gml:coordinates>
    </gml:Box>
  </gml:boundedBy>
<gml:featureMember>
  <ms:suscribers fid="suscribers.2">
    <gml:boundedBy>
        <gml:Box srsName="EPSG:4326">
            <gml:coordinates>11.521489,3.869029 11.521489,3.869029</gml:coordinates>
        </gml:Box>
    </gml:boundedBy>
    <ms:msGeometry>
    <gml:Point srsName="EPSG:4326">
      <gml:coordinates>11.521489,3.869029</gml:coordinates>
    </gml:Point>
    </ms:msGeometry>
    <ms:gid>2</ms:gid>
    <ms:osm_id>331136682</ms:osm_id>
    <ms:addr_house></ms:addr_house>
    <ms:amenity></ms:amenity>
    <ms:name>Yaoundé</ms:name>
    <ms:barrier></ms:barrier>

2 Answers 2

1

If your problem stil exists you could test with firebug if your features are added to your layer after the wfs-response came back:

wfsSuscribers.events.register('featuresadded', wfsSuscribers, function () {

    console.log("Number of Features:" + wfsSuscribers.features.length);
    map.zoomToExtent(wfsSuscribers.getDataExtent());
});

http://jsfiddle.net/expedio/ghyb52bw/

0

You may want to change the wfs_srs in your mapfile to 32232

3
  • Welcome to GIS SE! Your answer has been flagged up for review due to its brevity. Are you able to expand upon your answer to provide slightly more detailed advice, please?
    – PolyGeo
    Sep 25, 2013 at 21:02
  • thanx you for the answer.
    – Joel Wonna
    Sep 25, 2013 at 23:39
  • i have tried, the output projection has changed and the layer is still not displaying firebug <gml:boundedBy> <gml:Envelope srsName="EPSG:4326"> <gml:lowerCorner>410948.560703 768287.792950</gml:lowerCorner> <gml:upperCorner>439119.456303 783725.910509</gml:upperCorner> </gml:Envelope> </gml:boundedBy> <gml:featureMember> <ms:suscribers gml:id="suscribers.2"> <gml:boundedBy> <gml:Envelope srsName="EPSG:4326"> <gml:lowerCorner>3.869029 11.521489</gml:lowerCorner>
    – Joel Wonna
    Sep 25, 2013 at 23:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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