Examples
basics
filtering
- text filter
- bounding box filter
- nearest filter
- feature collection clipped
- feature collection filter
- convert to centroids
- buffer polygons
drawing
styling
querying
query a layersource
The example uses the QueryEngine Object to read data from a layer-source called "LONDONPOI_SHP", then applies a filter to this data and displays the data in an hmtl table.
For more information see:
window.onload = function () {
var qry = new Mapzania.QueryEngine();
var point = {
type: "Point",
coordinates: [-0.1, 51.5]
};
qry.usingLayerSource("LONDONPOI_SHP")
.filterByNearest(point, { take: 10 })
.apply()
.then(function (data) {
buildTable(data);
});
var buildTable = function (data) {
var html = "";
for (var i = 0; i < data.features.length; i++) {
var props = data.features[i].properties;
if (i == 0) {
html += "<tr>"
for (var prop in props)
html += "<th>" + prop + "</th>";
html += "</tr>";
}
html += "<tr>"
for (var prop in props) {
html += "<td>" + props[prop] + "</td>";
}
html += "</tr>";
}
$("#table").append(html);
}
};
#table {
width: 100%;
border:solid 1px;
font-size:12px;
}
tr{
border:solid 1px;
}
td, th{
border:solid 1px;
padding-left:5px;
}
<table id="table"></table>