[OpenLayers-Dev] reproject using vector and protocol (WFS) is not working

Bart van den Eijnden bartvde at osgis.nl
Wed Feb 3 04:35:37 EST 2010


Hi Steven,

the format reading the features is responsible for reprojection, not the layer. Have you tried supplying internalProjection and externalProjection through the formatOptions property of the protocol?

Is it not easier to have your WFS reproject the features for you?

Best regards,
Bart

On Feb 3, 2010, at 10:26 AM, Steven M. Ottens wrote:

> Hi all,
> 
> I'm trying to access a WFS in epsg:30800, while the background layer and all other WFS's are in epsg:4258. I've configured all WFS's using Vector and protocol.WFS. I've set the projection in the layer definition, and the WFS request does contain the correct epsg code, but the coordinates are still in 4258. I checked the Vector class and didn't see anything related to projection, am I correct in assuming that Vector.js together with the WFS protocol doesn't support reprojecting features? If so should I create a ticket, since WFS.js does support it (http://trac.openlayers.org/ticket/1406)
> 
> regards,
> Steven
> 
> Configuration of the working WFS:
> var wfs_nl_cp = new OpenLayers.Layer.Vector(
>     "The Netherlands: CP",
>     {
>         strategies: [new OpenLayers.Strategy.BBOX({resFactor: 1})],
>         visibility: true,
>         projection: new OpenLayers.Projection("EPSG:4258"),
>         protocol: new OpenLayers.Protocol.WFS({
>             version: "1.1.0",
>             srsName: "EPSG:4258",
>             extractAttributes:true, 
>             url: "http://esdin.geodan.nl/fgi/Kadaster/deegree-wfs/services",
>             featurePrefix: "CP",
>             featureType: "CadastralParcel",
>             featureNS: "urn:x-inspire:specification:gmlas:CadastralParcels:3.0",
>             geometryName: "geometry",
>             maxFeatures: "100",
>             sortBy: "label", //not supported
>             schema: "http://esdin.fgi.fi/esdin/Kadaster/deegree-wfs/services?request=DescribeFeatureType&version=1.1.0&service=WFS&typeName=CP:CadastralParcel&namespace=xmlns(xmlns:CP=urn:x-inspire:specification:gmlas:CadastralParcels:3.0)"
>         })
>     }
>     );
> and the not working WFS:
>     var wfs_se_gn = new OpenLayers.Layer.Vector(
>     "Sweden: GN",
>     {
>         strategies: [new OpenLayers.Strategy.BBOX({resFactor: 1})],
>         visibility: false,
>         styleMap: pointStyles,
>         projection: new OpenLayers.Projection("EPSG:30800"),
>         protocol: new OpenLayers.Protocol.WFS({
>             version: "1.1.0",
>             srsName: "EPSG:30800",
>             extractAttributes:true, 
>             url: "http://esdin.geodan.nl/fgi/NLSS/geoserver_esdin/wfs",
>             featurePrefix: "esdin",
>             featureType: "geographicalNames",
>             featureNS: "http://www.metainfo.se/esdin",
>             geometryName: "SHAPE",
>             schema: "http://esdin.geodan.nl/fgi/NLSS/geoserver_esdin/wfs?&request=DescribeFeatureType&version=1.1.0&typeName=esdin:geographicalNames"
>         })
>     }
>     );
> 
> The post request generated with the second layer is: 
> <wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.1.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <wfs:Query typeName="esdin:geographicalNames" srsName="EPSG:30800" xmlns:esdin="http://www.metainfo.se/esdin">
> <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
> <ogc:BBOX>
> <ogc:PropertyName>SHAPE</ogc:PropertyName>
> <gml:Envelope xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:30800">
> <gml:lowerCorner>-45.25 16.72265625</gml:lowerCorner>
> <gml:upperCorner>67.25 85.27734375</gml:upperCorner>
> </gml:Envelope>
> </ogc:BBOX>
> </ogc:Filter>
> </wfs:Query>
> </wfs:GetFeature>
> 
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20100203/03feb1ed/attachment.html


More information about the Dev mailing list