How can I show features (from an example file)? I tried many, many ways. This is a different route using a standard GML example file from OpenLayers.
Problem : With the shown code example, I don't see any features. There are no error messages.
In an Angular / typescript environment I tried also:
let polygonStyle = new Style({
fill: new Fill({
color: "rgba(255, 0, 0, 0.8)"
}),
stroke: new Stroke({
color: "#ffcc33",
width: 10
})
});
let vectorSource = new VectorSource({
format: new WFS({gmlFormat: new GML3() }),
url: 'http://osgis.terragis.net/openlayers/examples/gml/polygon.xml',
});
this.vectorLayer = new Vector({
source: vectorSource,
style: [polygonStyle]
});
this.map = new Map({
layers: [
new TileLayer({
source: new XYZ({
url: "https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png"
})
}),
this.vectorLayer
],
view: new View({
center: transform([0.532597, 47.428810], 'EPSG:4326', 'EPSG:3857'),
zoom: 12
}),
target: "map"
});