GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — iClient-JavaScript/examples/mapboxgl/01_mapQueryBySQL.html at master · SuperMap/iClient-JavaScript Expand file tree/ Copy path01_mapQueryBySQL.htmlMore file actions 135 lines (129 loc) · 5.24 KB / Copy path01_mapQueryBySQL.htmlFile metadata and controls135 lines (129 loc) · 5.24 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 <!--******************************************************************** * Copyright© 2000 - 2026 SuperMap Software Co.Ltd. All rights reserved. *********************************************************************--> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title data-i18n="resources.title_mapQueryBySQL"></title> <style> #toolbar { position: absolute; top: 50px; right: 10px; width: 240px; text-align: center; z-index: 1000; border-radius: 4px; } </style> </head> <body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;"> <div id="toolbar" class="panel panel-primary"> <div class='panel-heading'> <h5 class='panel-title text-center' data-i18n="resources.title_queryBySQL"></h5></div> <div class='panel-body content'> <div class='panel'> <div class='input-group'> <span class='input-group-addon'>SQL</span> <input min="0" class="form-control" id="sql" placeholder="SMID < 10" /> </div> </div> <input type="button" class="btn btn-default" data-i18n="[value]resources.text_query" onclick="query()"/> <input type="button" class="btn btn-default" data-i18n="[value]resources.text_input_value_clear" onclick="clearFeatures()"/> </div> </div> <div id="map" style="margin:0 auto;width: 100%;height: 100%"></div> <script type="text/javascript" include="bootstrap" src="../js/include-web.js"></script> <script type="text/javascript" src="../../dist/mapboxgl/include-mapboxgl.js"></script> <script type="text/javascript"> var host = window.isLocal ? window.server : "https://iserver.supermap.io"; var url = host + "/iserver/services/map-world/rest/maps/World"; var attribution = "<a href='https://www.mapbox.com/about/maps/' target='_blank'>© Mapbox </a>" + "with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a> | </span>" + " Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> "; var map = new mapboxgl.Map({ container: 'map', style: { "version": 8, "sources": { "raster-tiles": { "attribution": attribution, "type": "raster", "tiles": [host + '/iserver/services/maps/rest/maps/World/zxyTileImage.png?prjCoordSys='+encodeURIComponent('{"epsgCode":3857}')+'&z={z}&x={x}&y={y}'], "tileSize": 256, }, }, "layers": [{ "id": "simple-tiles", "type": "raster", "source": "raster-tiles", "minzoom": 0, "maxzoom": 22 }], }, center: [0, 0], maxZoom: 18, zoom: 2 }); map.addControl(new mapboxgl.supermap.LogoControl({ link: "https://iclient.supermap.io" }), 'bottom-right'); map.addControl(new mapboxgl.NavigationControl(), 'top-left'); function query() { clearFeatures(); var sql = document.getElementById("sql").value || "SMID < 10"; var param = new mapboxgl.supermap.QueryBySQLParameters({ queryParams: { attributeFilter: sql } }); // queryService = new mapboxgl.supermap.QueryService(url).queryBySQL(param, function (serviceResult) { // var recordsets = serviceResult && serviceResult.result && serviceResult.result.recordsets; // var features = recordsets && recordsets[0] && recordsets[0].features; // map.addLayer({ // "id": "points", // "type": "circle", // "paint": { // "circle-radius": 6, // "circle-color": "#007cbf", // "circle-opacity":0.1, // "circle-stroke-width":2, // "circle-stroke-color":"#007cbf", // "circle-stroke-opacity":0.5 // }, // "source": { // "type": "geojson", // "data": features // } // }); // }); new mapboxgl.supermap.QueryService(url).queryBySQL(param).then(function (serviceResult) { var recordsets = serviceResult && serviceResult.result && serviceResult.result.recordsets; var features = recordsets && recordsets[0] && recordsets[0].features; map.addLayer({ "id": "points", "type": "circle", "paint": { "circle-radius": 6, "circle-color": "#007cbf", "circle-opacity":0.1, "circle-stroke-width":2, "circle-stroke-color":"#007cbf", "circle-stroke-opacity":0.5 }, "source": { "type": "geojson", "data": features } }); }); } function clearFeatures() { if (map.getLayer('points')) { map.removeLayer('points'); map.removeSource('points'); } } </script> </body> </html> |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |