Skip to main content
deleted 42 characters in body; edited title
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

OpenLayers 4 - Read Reading GML features in OpenLayers 4?

I use OpenLayers 4.6 and I want to read a feature from GML string. The GML looks like:

<?xml version="1.0" encoding="UTF-8"?>
<gml:Polygon xmlns:gml="http://www.opengis.net/gml" 
    xmlns:sch="http://www.ascc.net/xml/schematron" 
    xmlns:xlink="http://www.w3.org/1999/xlink" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema" srsDimension="2">
   <gml:exterior>
      <gml:LinearRing srsDimension="2">
         <gml:posList>37.15 36.15 37.15 36.3 37.5 36.3 37.5 36.15 37.15 36.15</gml:posList>
      </gml:LinearRing>
   </gml:exterior>
</gml:Polygon>

I know that I need to specify the featureNS and featureType to read the feature using ol.format.GML3, but I don't know how to set them properly:

let feature = new ol.format.GML3({
  srsName: 'EPSG:4326',
  featureType: '???',
  featureNS: '???'
}).readFeatures(data);

Any help will be appreciated. Regards.

OpenLayers 4 - Read GML features

I use OpenLayers 4.6 and I want to read a feature from GML string. The GML looks like:

<?xml version="1.0" encoding="UTF-8"?>
<gml:Polygon xmlns:gml="http://www.opengis.net/gml" 
    xmlns:sch="http://www.ascc.net/xml/schematron" 
    xmlns:xlink="http://www.w3.org/1999/xlink" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema" srsDimension="2">
   <gml:exterior>
      <gml:LinearRing srsDimension="2">
         <gml:posList>37.15 36.15 37.15 36.3 37.5 36.3 37.5 36.15 37.15 36.15</gml:posList>
      </gml:LinearRing>
   </gml:exterior>
</gml:Polygon>

I know that I need to specify the featureNS and featureType to read the feature using ol.format.GML3, but I don't know how to set them properly:

let feature = new ol.format.GML3({
  srsName: 'EPSG:4326',
  featureType: '???',
  featureNS: '???'
}).readFeatures(data);

Any help will be appreciated. Regards.

Reading GML features in OpenLayers 4?

I use OpenLayers 4.6 and I want to read a feature from GML string. The GML looks like:

<?xml version="1.0" encoding="UTF-8"?>
<gml:Polygon xmlns:gml="http://www.opengis.net/gml" 
    xmlns:sch="http://www.ascc.net/xml/schematron" 
    xmlns:xlink="http://www.w3.org/1999/xlink" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema" srsDimension="2">
   <gml:exterior>
      <gml:LinearRing srsDimension="2">
         <gml:posList>37.15 36.15 37.15 36.3 37.5 36.3 37.5 36.15 37.15 36.15</gml:posList>
      </gml:LinearRing>
   </gml:exterior>
</gml:Polygon>

I know that I need to specify the featureNS and featureType to read the feature using ol.format.GML3, but I don't know how to set them properly:

let feature = new ol.format.GML3({
  srsName: 'EPSG:4326',
  featureType: '???',
  featureNS: '???'
}).readFeatures(data);
Notice removed Improve details by abd0991
Bounty Ended with senol ozgur's answer chosen by abd0991
Notice added Improve details by abd0991
Bounty Started worth 50 reputation by abd0991
spelling
Source Link
nmtoken
  • 13.6k
  • 5
  • 38
  • 89

Openlayers OpenLayers 4 - Read GML features

I use openlayersOpenLayers 4.6 and I want to read a feature from GML string. The GML looks like:

<?xml version="1.0" encoding="UTF-8"?>
<gml:Polygon xmlns:gml="http://www.opengis.net/gml" 
    xmlns:sch="http://www.ascc.net/xml/schematron" 
    xmlns:xlink="http://www.w3.org/1999/xlink" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema" srsDimension="2">
   <gml:exterior>
      <gml:LinearRing srsDimension="2">
         <gml:posList>37.15 36.15 37.15 36.3 37.5 36.3 37.5 36.15 37.15 36.15</gml:posList>
      </gml:LinearRing>
   </gml:exterior>
</gml:Polygon>

I know that I need to specify the featureNS and featureType to read the featuefeature using ol.format.GML3, but I don't know how to set them properly:

let feature = new ol.format.GML3({
  srsName: 'EPSG:4326',
  featureType: '???',
  featureNS: '???'
}).readFeatures(data);

Any help will be appreciated. Regards.

Openlayers 4 - Read GML features

I use openlayers 4.6 and I want to read a feature from GML string. The GML looks like:

<?xml version="1.0" encoding="UTF-8"?>
<gml:Polygon xmlns:gml="http://www.opengis.net/gml" 
    xmlns:sch="http://www.ascc.net/xml/schematron" 
    xmlns:xlink="http://www.w3.org/1999/xlink" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema" srsDimension="2">
   <gml:exterior>
      <gml:LinearRing srsDimension="2">
         <gml:posList>37.15 36.15 37.15 36.3 37.5 36.3 37.5 36.15 37.15 36.15</gml:posList>
      </gml:LinearRing>
   </gml:exterior>
</gml:Polygon>

I know that I need to specify the featureNS and featureType to read the featue using ol.format.GML3, but I don't know how to set them properly:

let feature = new ol.format.GML3({
  srsName: 'EPSG:4326',
  featureType: '???',
  featureNS: '???'
}).readFeatures(data);

Any help will be appreciated. Regards.

OpenLayers 4 - Read GML features

I use OpenLayers 4.6 and I want to read a feature from GML string. The GML looks like:

<?xml version="1.0" encoding="UTF-8"?>
<gml:Polygon xmlns:gml="http://www.opengis.net/gml" 
    xmlns:sch="http://www.ascc.net/xml/schematron" 
    xmlns:xlink="http://www.w3.org/1999/xlink" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema" srsDimension="2">
   <gml:exterior>
      <gml:LinearRing srsDimension="2">
         <gml:posList>37.15 36.15 37.15 36.3 37.5 36.3 37.5 36.15 37.15 36.15</gml:posList>
      </gml:LinearRing>
   </gml:exterior>
</gml:Polygon>

I know that I need to specify the featureNS and featureType to read the feature using ol.format.GML3, but I don't know how to set them properly:

let feature = new ol.format.GML3({
  srsName: 'EPSG:4326',
  featureType: '???',
  featureNS: '???'
}).readFeatures(data);

Any help will be appreciated. Regards.

Source Link
abd0991
  • 462
  • 4
  • 18

Openlayers 4 - Read GML features

I use openlayers 4.6 and I want to read a feature from GML string. The GML looks like:

<?xml version="1.0" encoding="UTF-8"?>
<gml:Polygon xmlns:gml="http://www.opengis.net/gml" 
    xmlns:sch="http://www.ascc.net/xml/schematron" 
    xmlns:xlink="http://www.w3.org/1999/xlink" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema" srsDimension="2">
   <gml:exterior>
      <gml:LinearRing srsDimension="2">
         <gml:posList>37.15 36.15 37.15 36.3 37.5 36.3 37.5 36.15 37.15 36.15</gml:posList>
      </gml:LinearRing>
   </gml:exterior>
</gml:Polygon>

I know that I need to specify the featureNS and featureType to read the featue using ol.format.GML3, but I don't know how to set them properly:

let feature = new ol.format.GML3({
  srsName: 'EPSG:4326',
  featureType: '???',
  featureNS: '???'
}).readFeatures(data);

Any help will be appreciated. Regards.