[OpenLayers-Users] OpenLayers 3 ServerVector

terra map terramap at avitarassociates.com
Thu Aug 14 06:46:35 PDT 2014


Hello all,


I have the following code I am using to try and connect to a WFS service
that will respond with GML features.  It seems to work as I can see the
features in the DOM under xmlhttp, I can also use
pSource.readFeatures(xmlhttp.response) to view them.  However nothing is
displayed on the map.  Any guidance would greatly be appreciated.

Thanks in advance,

Chad

var pSource = new ol.source.ServerVector({
              format: new ol.format.WFS({
                featureNS: 'http://fdo.osgeo.org/schemas/feature/ns108078613
',
                featureType: 'Parcels',
                srsName: 'EPSG:3857',
                schemaLocation: 'http://www.opengis.net/gml
http://schemas.opengis.net/gml/3.1.1/base/feature.xsd
http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd'
              }),
              loader: function(extent, resolution, projection) {
                        var url = '
http://localhost/mapguide/mapagent/mapagent.fcgi?REQUEST=GETFEATURE&SERVICE=WFS&VERSION=1.1.0&PROPERTYNAME=PID%2C+Geometry&MAXFEATURES=200&SRSNAME=EPSG:3857&TYPENAME=ns108078613%3AParcels&FEATUREID=&FILTER=&BBOX=&OUTPUTFORMAT=GML3
';
                        xmlhttp.open("GET", url, true);
                        xmlhttp.send();
              },
              projection: 'EPSG:3857',

            });

          var parcels = new ol.layer.Vector({
            source: pSource,
            style: new ol.style.Style({
              stroke: new ol.style.Stroke({
                color: 'color: rgba(156, 198, 182, 1);',
                width: 6
              }),
              fill: new ol.style.Fill({
                color: 'rgba(156, 198, 182, 0.4)'
              })
            })

          });

      var map = new ol.Map({
        target: 'map',
////////////////////
        layers: [
          new ol.layer.Tile({
            source: new ol.source.MapQuest({layer: 'sat'})
          }),
          parcels
          ],
//////////////////////////
        view: new ol.View({
          center: [-8069122.324214099, 5397167.024867109],
          zoom: 10,
          extent: [-8088575.41281466, 5379737.43765192, -8074025.78666561,
5397587.6602848]
        }),
//////////////////////////
        controls: [
        new ol.control.MousePosition({
          target:'pos'
        })
        ]

      });
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20140814/4d0089de/attachment.html>


More information about the Users mailing list