本文共 1463 字,大约阅读时间需要 4 分钟。
OpenLayers ?????????? GIS ??????? WebGIS ??????????????? OpenLayers ????? SHP ???????? GIS ?????
? GIS ????SHP ???Shapefile????????????????????????????OpenLayers ?????????? GIS ?????????????? SHP ??????????????????
import ol from 'openlayers'; // ?? OpenLayers ?import sh from 'sharp'; // ?? Sharp ?????? SHP ?? // ??????const shpPath = 'your/shp/file.shp'; // ?? Sharp ?? SHP ??const shp = await sh.file(shpPath).geojson();
??????????? Sharp ??? SHP ????????? GeoJSON ??????OpenLayers ???? GeoJSON ??????????????????????????????????
???????? OpenLayers GIS ???????????? SHP ??????????
// ??? OpenLayers ??const initExtent = ol.proj.fromLonLat([minX, maxY, maxX, minY]); // ????const map = new ol.Map({target: 'map-container',layers: [],view: new ol.View({center: ol.proj.toLonLat([averageX, averageY]),zoom: initialZoom})}); // ?? GeoJSON ???map.addLayer({source: shp,style: new ol.style.Styles({image: new ol.image ol.getImageLoader().load(shp),// ??????????????})}); ??????????????? GeoJSON ????? OpenLayers ???????????? GIS ????????????????????????? SHP ??? OpenLayers ??????? GIS ???
? OpenLayers GIS ??????????????????????????????
?????????????????????? OpenLayers ???????? GIS ??????????????????????OpenLayers ?? GIS ????????
转载地址:http://ffpfk.baihongyu.com/