Remove jquery from getfeatureinfo-layers example

This commit is contained in:
Frederic Junod
2016-02-29 15:32:28 +01:00
parent 5b38eaa116
commit aaf03a8fc2
2 changed files with 16 additions and 19 deletions
-2
View File
@@ -9,8 +9,6 @@ docs: >
`ol.format.WMSGetFeatureInfo` format object, which allows features returned `ol.format.WMSGetFeatureInfo` format object, which allows features returned
by a single WMS GetFeatureInfo request that asks for more than one layer by a single WMS GetFeatureInfo request that asks for more than one layer
to be read by layer name. to be read by layer name.
resources:
- https://code.jquery.com/jquery-1.11.2.min.js
--- ---
<table id="info"> <table id="info">
<tr> <tr>
+16 -17
View File
@@ -1,24 +1,23 @@
goog.require('ol.format.WMSGetFeatureInfo'); goog.require('ol.format.WMSGetFeatureInfo');
$.ajax({ fetch('data/wmsgetfeatureinfo/osm-restaurant-hotel.xml').then(function(response) {
url: './data/wmsgetfeatureinfo/osm-restaurant-hotel.xml', return response.text();
success: function(response) { }).then(function(response) {
// this is the standard way to read the features // this is the standard way to read the features
var allFeatures = new ol.format.WMSGetFeatureInfo().readFeatures(response); var allFeatures = new ol.format.WMSGetFeatureInfo().readFeatures(response);
$('#all').html(allFeatures.length.toString()); document.getElementById('all').innerText = allFeatures.length.toString();
// when specifying the 'layers' options, only the features of those // when specifying the 'layers' options, only the features of those
// layers are returned by the format // layers are returned by the format
var hotelFeatures = new ol.format.WMSGetFeatureInfo({ var hotelFeatures = new ol.format.WMSGetFeatureInfo({
layers: ['hotel'] layers: ['hotel']
}).readFeatures(response); }).readFeatures(response);
$('#hotel').html(hotelFeatures.length.toString()); document.getElementById('hotel').innerText = hotelFeatures.length.toString();
var restaurantFeatures = new ol.format.WMSGetFeatureInfo({ var restaurantFeatures = new ol.format.WMSGetFeatureInfo({
layers: ['restaurant'] layers: ['restaurant']
}).readFeatures(response); }).readFeatures(response);
$('#restaurant').html(restaurantFeatures.length.toString()); document.getElementById('restaurant').innerText = restaurantFeatures.length.toString();
}
}); });