With OpenLayers 6.12, I cannot visualize a layer concerning Martinique EPSG:32620.
As I have no error I don't know if it comes from this projection or from the GML which would not be compatible. I know however that there is a result for https://datacarto.geomartinique.fr/wfs?version=2.0.0&request=GetFeature&typeNames=ms:pref_chlordecone_analyse_sol_v2_s_972&outputFormat=gml3&SRSNAME=EPSG:32620&bbox=-6800151.831794434,1640142.7893100686,-6780421.9682055665,1647728.6106899313,EPSG:3857
but the features remain hopelessly empty. What to do?
My code :
var chlorodeconeMartiniqueSource = new ol.source.Vector({
format: new ol.format.WFS(),
loader: function(extent, resolution, projection) {
var proj = projection.getCode();
var url = 'https://datacarto.geomartinique.fr/wfs?version=2.0.0&request=GetFeature&typeName=ms:pref_chlordecone_analyse_sol_v2_s_972&outputFormat=gml3&SRSNAME=EPSG:32620&' + 'bbox=' + extent.join(',') + ',' + 'EPSG:3857'
var xhr = new XMLHttpRequest();
xhr.open('GET', url);
xhr.onload = function() {
if (xhr.status == 200) {
console.log('url',url)
var features = chlorodeconeMartiniqueSource.getFormat().readFeatures(xhr.responseText, { //chlorodeconeMartiniqueSource.getFormat()
dataProjection: 'EPSG:32620',
featureProjection: 'EPSG:3857'
})
chlorodeconeMartiniqueSource.addFeatures(features)
console.log('xhr.response',xhr.responseText)
console.log('features',features)
console.log('chlorodeconeMartiniqueSource',chlorodeconeMartiniqueSource)
}
}
xhr.send();
},
strategy: ol.loadingstrategy.bbox,
});
EPSG:32620
with proj4? (see openlayers.org/en/latest/apidoc/…)?