How to customize the map of coordinate system in GIS development
Editor to share with you how to customize the map of the coordinate system in GIS development. I hope you will get something after reading this article. Let's discuss it together.
The map of the custom coordinate system can load the base map according to the parameters of the coordinate system. The coordinate system is not limited to wgs84 (EPSG:4326), webmercator (EPSG:3857), which is a common coordinate system.
At present, openlayers and maptalks are found to be better used in open source. With the help of the open source library of proj4.js, the coordinate system of custom map is realized and map slices are loaded.
Sample URL of openlayers:
Https://openlayers.org/en/latest/examples/reprojection-by-code.html custom coordinate system, which sets the coordinate system of the map to this coordinate system
Proj4.defs ('EPSG:XXXX',' proj4 string')
Ol.proj.proj4.register (proj4)
Var map = new ol.Map ({
Layers: layers
Target: 'map'
View: new ol.View ({
Center: center
Projection: 'EPSG:XXXX'
})
});
Maptalks sample website: https://maptalks.org/examples/cn/tilelayer-projection/proj4js/#tilelayer-projection_proj4js is also used to define the coordinate system / / EPSG:3857's proj definition
Var proj3857 ='+ proj=merc + aqu 6378137 + bang 6378137 + lat_ts=0.0 + lon_0=0.0 + x-ray 0.0 + y-bike-0 + kang-0 + units=m + nadgrids=@null + wktext + no_defs'
Var proj4 = proj4 ('WGS84', proj3857)
/ / define a custom projection object
Var projection = {
Code: 'proj4-merc', / / code of the projection
Project: function (c) {/ / from wgs84 to EPSG3857
Var pc = proj4.forward (c.toArray ())
Return new maptalks.Coordinate (pc)
}
Unproject: function (pc) {/ / from EPSG3857 to wgs84
Var c = proj4.inverse (pc.toArray ())
Return new maptalks.Coordinate (c)
}
}
Relatively speaking, maptalks can convert the pitch angle and view it in three-dimensional form, which is similar to the effect of Baidu and Gaode in the current two-dimensional map.
Mapbox-gl supports webmercator coordinate system by default. Open source has rewritten the domestic cgcs2000 coordinate system support, but has not been able to achieve the effect of custom coordinate system.
The api of simple coordinate system is also realized in leaflet, and the effect of plane coordinate system can also be realized directly.
After reading this article, I believe you have a certain understanding of "how to customize the map of coordinate system in GIS development". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!