1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <!--********************************************************************
- * Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
- *********************************************************************-->
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title data-i18n="resources.title_getFeatureByBuffer"></title>
- <script type="text/javascript" src="../js/include-web.js"></script>
- </head>
- <body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
- <div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
- <script type="text/javascript" src="../../dist/leaflet/include-leaflet.js"></script>
- <script type="text/javascript">
- var host = window.isLocal ? window.server : "https://iserver.supermap.io";
- var map, resultLayer,
- baseUrl = host + "/iserver/services/map-world/rest/maps/World",
- url = host + "/iserver/services/data-world/rest/data";
- map = L.map('map', {
- preferCanvas: true,
- crs: L.CRS.EPSG4326,
- center: {lon: 0, lat: 0},
- maxZoom: 18,
- zoom: 2
- });
- L.supermap.tiledMapLayer(baseUrl).addTo(map);
- query();
- function query() {
- var polygon = L.polygon([[-20, 20], [0, 20], [0, 40], [-20, 40], [-20, 20]], {color: 'red'});
- var popup = L.popup().setContent(resources.text_bufferDistance+' = 10');
- polygon.addTo(map).bindPopup(popup).openPopup();
- var bufferParam = new SuperMap.GetFeaturesByBufferParameters({
- datasetNames: ["World:Capitals"],
- bufferDistance: 10,
- geometry: polygon
- });
- L.supermap
- .featureService(url)
- .getFeaturesByBuffer(bufferParam, function (serviceResult) {
- resultLayer = L.geoJSON(serviceResult.result.features, {
- onEachFeature: function (feature, layer) {
- layer.bindPopup(resources.text_capital+":" + feature.properties.CAPITAL);
- }
- }).addTo(map);
- });
- }
- </script>
- </body>
- </html>
|