openlayers 4.4: загрузка точек gml3 и нанесение символов, обычных многоугольников или значков - PullRequest
0 голосов
/ 14 февраля 2019

содержимое readFeatures - пустой массив, кажется, что проблема с чтением формата gml3?А потом, как поставить кликабельный символ на эти точки?

var basiasWfsSource = new ol.source.Vector({
  format: new ol.format.GML3(),
  loader: function(extent, resolution, projection) {
     var proj = projection.getCode();
     var url = 'http://geoservices.brgm.fr/risques?&SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&typename=BASIAS_LOCALISE&SRSNAME=EPSG:4326&outputformat=gml3&bbox='
     + extent.join(',') + ',' + proj ;
     console.log( 'url', url);
     var xhr = new XMLHttpRequest();
     xhr.open('GET', url);
     var onError = function() {
      console.log( 'error'); 
       basiasWfsSource.removeLoadedExtent(extent);
     }
     xhr.onerror = onError;
     xhr.onload = function() {
       if (xhr.status == 200) {
       console.log( 'format', basiasWfsSource.getFormat());
         basiasWfsSource.addFeatures(
             basiasWfsSource.getFormat().readFeatures(xhr.responseText,{ 
dataProjection: 'EPSG:4326',
featureProjection:'EPSG:3857' })); //pour adapter la projection à celle de la view
       console.log( 'resultat', xhr.responseText);
       console.log( 'features', basiasWfsSource.getFormat().readFeatures(xhr.responseText,{ 
dataProjection: 'EPSG:4326',
featureProjection:'EPSG:3857' }));} else {
         onError();
       }
     }
     xhr.send();
   },
   strategy: ol.loadingstrategy.bbox
 });
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...