[OpenLayers-Users] WFS: Problem retrieving Features from
Geoserver/PostGIS
Bart van den Eijnden
bartvde at osgis.nl
Thu Aug 12 03:31:55 EDT 2010
Hi,
use:
featureType: "ogm_polygons",
featurePrefix: "OpenGeoMap"
alternatively, specify featureNS instead of featurePrefix. That's the namespace which is bound by Geoserver to the OpenGeoMap prefix.
Best regards,
Bart
--
Looking for flexible support on OpenLayers or GeoExt? Please check out http://www.osgis.nl/support.html
Bart van den Eijnden
OSGIS
bartvde at osgis.nl
On Aug 12, 2010, at 9:24 AM, andreia farrér wrote:
> Dear List,
>
> I am trying to modify the wfs-editor.html-example for digitizing Points, Lines and Polygons. First I created a polygon-shapefile (one polygon in it, extending a big part of eastern Switzerland) in QGIS and imported it into my PostGIS-DB as "ogm_polygons"; then I published the layer in Geoserver. Now I would like to show the polygon-features in my map which somehow doesn't function.
> Here an extract of my code:
>
> Ext.BLANK_IMAGE_URL = "../ext/resources/images/default/s.gif";
>
> Ext.onReady(function() {
> OpenLayers.ProxyHost = "../cgi-bin/proxy.cgi?url=";
>
> var saveStrategy = new OpenLayers.Strategy.Save({
> onCommit: function() {
> saveStrategy.ogm_polygons.refresh();
> }
> });
>
> var ogm_polygons = new OpenLayers.Layer.Vector("polygons",{
> strategies: [new OpenLayers.Strategy.Fixed(), saveStrategy],
> protocol: new OpenLayers.Protocol.WFS({
> url: "http://localhost:8090/geoserver/wfs",
> featureType: "OpenGeoMap:ogm_polygons",
> geometryName: "the_geom",
> srsName: "EPSG:21781",
> maxExtent: new OpenLayers.Bounds(140000, -240000, 1380000, 580000)
> })
> });
>
> var map_options = {maxExtent: new OpenLayers.Bounds(484000, 63000, 835000, 296000),
> numZoomLevels: 12, maxScale: 5000, minScale: 2000000, units: 'm', projection: 'EPSG:21781'};
>
> var map = new OpenLayers.Map(map, map_options,{
> allOverlays: true
> });
>
> map.addLayer(ogm_polygons);
> });
>
> Unfortunately the Layer won't show in my Mapwindow. If i fire up HttpFox and check the POST-Statement I get the following message:
>
> <wfs:FeatureCollection xsi:schemaLocation="OpenGeoMap http://localhost:8090/geoserver/wfs?service=WFS&version=1.0.0&request=DescribeFeatureType&typeName=OpenGeoMap%3Aogm_polygons http://www.opengis.net/wfs http://localhost:8090/geoserver/schemas/wfs/1.0.0/WFS-basic.xsd">
> <gml:boundedBy>
> <gml:null>unknown</gml:null>
> </gml:boundedBy>
> <gml:featureMember>
> <OpenGeoMap:ogm_polygons fid="ogm_polygons.1">
> <OpenGeoMap:bezeichnun>test</OpenGeoMap:bezeichnun>
> <OpenGeoMap:litho_01>l1</OpenGeoMap:litho_01>
> <OpenGeoMap:the_geom>
> <gml:MultiPolygon srsName="http://www.opengis.net/gml/srs/epsg.xml#21781">
> <gml:polygonMember>
> <gml:Polygon>
> <gml:outerBoundaryIs>
> <gml:LinearRing>
> <gml:coordinates decimal="." cs="," ts=" ">
> 47701.85817123,185193.40602232 120638.63788536,378756.39834058 328227.9339948,448887.91729647 328227.9339948,448887.91729647 317006.89096185,78593.49720937 47701.85817123,185193.40602232
> </gml:coordinates>
> </gml:LinearRing>
> </gml:outerBoundaryIs>
> </gml:Polygon>
> </gml:polygonMember>
> </gml:MultiPolygon>
> </OpenGeoMap:the_geom>
> </OpenGeoMap:ogm_polygons>
> </gml:featureMember>
> </wfs:FeatureCollection>
>
> In my eyes this looks totally fine, but I'm absolutely clueless why the feature won't show in my Map!
> Has anybody any idea on what I'm doing wrong?
> Any help is greatly appreciated; many thanks already in advance!
> Sincerely
> Andreia
>
>
>
> --
> Andreia Farrér, Birmensdorferstr. 260, 8055 Zürich; phone: +41 78 825 44 93
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100812/5e3efdf1/attachment.html
More information about the Users
mailing list