12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <!--********************************************************************
- * Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
- *********************************************************************-->
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title data-i18n="resources.title_overlayAnalyst"></title>
- <script type="text/javascript" src="../js/include-web.js"></script>
- <script type="text/javascript" src="../../dist/ol/include-ol.js"></script>
- </head>
- <body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%; position: absolute;top: 0;">
- <div id="map" style="width: 100%;height:100%"></div>
- <script type="text/javascript">
- var map, options,
- baseUrl = (window.isLocal ? window.server : "https://iserver.supermap.io")+"/iserver/services/map-jingjin/rest/maps/京津地区人口分布图_专题图",
- serviceUrl = (window.isLocal ? window.server : "https://iserver.supermap.io")+"/iserver/services/spatialanalyst-sample/restjsr/spatialanalyst";
- var extent = [104.07, 30.54, 119.51, 42.31];
- new ol.supermap.MapService(baseUrl).getMapInfo(function (serviceResult) {
- var mapJSONObj = serviceResult.result;
- map = new ol.Map({
- target: 'map',
- controls: ol.control.defaults({attributionOptions: {collapsed: false}})
- .extend([new ol.supermap.control.Logo()]),
- view: new ol.View({
- center: [116.77, 40.04],
- zoom: 8,
- projection: "EPSG:4326",
- multiWorld: true
- })
- });
- options = ol.source.TileSuperMapRest.optionsFromMapJSON(baseUrl, mapJSONObj);
- var layer = new ol.layer.Tile({
- source: new ol.source.TileSuperMapRest(options)
- });
- map.addLayer(layer);
- overlayAnalystProcess();
- });
- function overlayAnalystProcess() {
- var datasetOverlayAnalystParameters = new SuperMap.DatasetOverlayAnalystParameters({
- sourceDataset: "BaseMap_R@Jingjin",
- operateDataset: "Neighbor_R@Jingjin",
- tolerance: 0,
- operation: SuperMap.OverlayOperationType.UNION
- });
- new ol.supermap.SpatialAnalystService(serviceUrl).overlayAnalysis(datasetOverlayAnalystParameters, function (serviceResult) {
- var resultLayer = new ol.layer.Vector({
- source: new ol.source.Vector({
- features: (new ol.format.GeoJSON()).readFeatures(serviceResult.result.recordset.features)
- }),
- style: new ol.style.Style({
- stroke: new ol.style.Stroke({
- color: 'rgba(100, 100, 225, 10)',
- width: 3
- }),
- fill: new ol.style.Fill({
- color: 'rgba(0, 0, 255, 0.1)'
- })
- })
- });
- map.addLayer(resultLayer);
- });
- }
- </script>
- </body>
- </html>
|