I want to show on the map the features of the saved layers in a Geoserver server, but I dont know how to do this....
Like this, but with the dragbox interaction...
I have this code:
var select = new ol.interaction.Select(); mapa.addInteraction(select); var selectedFeatures = select.getFeatures(); var dragBox = new ol.interaction.DragBox({ condition: ol.events.condition.always, style: new ol.style.Style({ stroke: new ol.style.Stroke({ color: [0, 0, 255, 1] }) }) }); mapa.addInteraction(dragBox); dragBox.on('boxend', function(e) { if (capaActiva != null) { var info = []; var extent = dragBox.getGeometry().getExtent(); var source = capaActiva.getSource(); console.log(source); var url = source.getGetFeatureInfoUrl(extent, viewResolution, 'EPSG:3857',{'INFO_FORMAT': 'text/plain'}); console.log(url); } else { Ext.MessageBox.show({ title: 'Error', msg: 'Check a layer', buttonText: { ok: 'Aceptar', } }); } });
أكثر...
Like this, but with the dragbox interaction...
I have this code:
var select = new ol.interaction.Select(); mapa.addInteraction(select); var selectedFeatures = select.getFeatures(); var dragBox = new ol.interaction.DragBox({ condition: ol.events.condition.always, style: new ol.style.Style({ stroke: new ol.style.Stroke({ color: [0, 0, 255, 1] }) }) }); mapa.addInteraction(dragBox); dragBox.on('boxend', function(e) { if (capaActiva != null) { var info = []; var extent = dragBox.getGeometry().getExtent(); var source = capaActiva.getSource(); console.log(source); var url = source.getGetFeatureInfoUrl(extent, viewResolution, 'EPSG:3857',{'INFO_FORMAT': 'text/plain'}); console.log(url); } else { Ext.MessageBox.show({ title: 'Error', msg: 'Check a layer', buttonText: { ok: 'Aceptar', } }); } });
أكثر...