SuperMap / iClient-JavaScript

Modern GIS Web Client for JavaScript, based on Leaflet\OpenLayers\MapboxGL-JS\Classic(iClient8C), enhanced with ECharts\D3\MapV etc. Contributed by SuperMap & community.
https://iclient.supermap.io
Apache License 2.0
829 stars 282 forks source link

How to enable custom coordinate systems in maps using iclient for maplibregl. #486

Open gisxuh opened 1 month ago

gisxuh commented 1 month ago

https://iclient.supermap.io/examples/maplibregl/editor.html#mvtVectorTile_2362

Could you please explain how to implement the second method of registering a custom coordinate system in this demo? I've tried to define a WKT but the map won't display. Does it involve compatibility issues with JavaScript libraries?

songyumeng commented 1 month ago

Thank you for your issue. If you want to load a custom projection map,the following prerequisites must be met: 1. Use maplibre-gl-enhance.js instead of maplibre-gl.js 2. Construct CRS parameters,new maplibregl.CRS(name,wkt,extent); name: coordinate system name, required wkt: WKT or Proj4 representation of the coordinate system, required. extent: projection range of the current coordinate system,not WGS84 range, [left, bottom, right, top], required. 3. Pass the constructed crs to map

Note that, only raster source and vector source are should be this custom coordinate systems. Geojson source, center , marker, etc. are still WGS84 coordinates.

If you still have problems, can you provide an online example, or your code and map url?

gisxuh commented 1 month ago

Hello, @songyumeng .Thank you for your answer. With your help, I have successfully implemented the use of a custom coordinate system map and loaded a WTMS map service. But when I tried to load the TMS published by GeoServer using the Maplibre gl API, I was not successful. Excuse me, does maplibre-gs-enhance.js not support custom coordinate system TMS services and generate 3D buildings?

songyumeng commented 1 month ago

TMS services and 3D buildings is supported.

songyumeng commented 1 month ago

When loading the TMS service, you need to make sure that the 0th level resolution of the service is consistent with the 0th level resolution calculated by maplibre-gl-enhance. The calculation method of maplibre-gl-enhance's 0th level resolution is: Math.max(bounds.width,bounds.height)/512