[OpenLayers-Users] Reprojecting on the fly a GML layer from WFS
toni hernández
toni at sigte.udg.edu
Thu Jul 9 00:05:47 PDT 2015
Hi there,
I am working with Openlayers 3.6 and I am trying to display a gml layer
from a WFS service. And not only that, I am also trying to reproject
this layer from epsg:4326 to epsg:3857. This part of the code looks like:
vectorSource.addFeatures(gmlFormat.readFeatures(data,
{dataProjection:'EPSG:4326', featureProjection:'EPSG:3857'}));
The entire example is here
http://sigserver4.udg.edu/apps/ol3/wfs_usa_states.html
After loading the page, no error is thrown but the gml layer is not
displayed.
After executing this (in the javascript console)
vectorSource.getFeatures()[5].getGeometry().getCoordinates()
I get something like
[[[[4641827.511692658, NaN, 0], [4626910.811245848, NaN, 0],
[4607302.996137521, NaN, 0], more...
So, Is there a problem reprojecting "minus" coordinates formated like
"-xxx.xxxx"?
The same example works fine if I add the outputformat=JSON to the WFS
call, but I would like to use GML if possible for didactic purposes (I
am developing a course about OpenLayers). Also, the example works fine
if I do not reproject features, and change the srsnam param to
srsname=EPSG:3857.
Any ideas?
Thank you all.
--
*Toni Hernández Vallès*
Servei de Sistemes d'Informació Geogràfica i Teledetecció
-
Universitat de Girona
*SIGTE*
-
Pl. Ferrater Mora 1
17071 Girona
Tel +34 972 418 039 (7026 intern)
toni at sigte.udg.edu <mailto:toni at sigte.udg.edu>
http://www.sigte.udg.edu
Twitter http://twitter.com/SIGTE_UDG
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20150709/d6899e2c/attachment.html>
More information about the Users
mailing list