iClient-JavaScript icon indicating copy to clipboard operation
iClient-JavaScript copied to clipboard

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

Open gisxuh opened this issue 1 year ago • 4 comments

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?

gisxuh avatar Sep 12 '24 12:09 gisxuh

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?

songyumeng avatar Sep 13 '24 03:09 songyumeng

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?

gisxuh avatar Sep 14 '24 04:09 gisxuh

TMS services and 3D buildings is supported.

songyumeng avatar Sep 26 '24 09:09 songyumeng

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

songyumeng avatar Sep 26 '24 09:09 songyumeng

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jan 31 '25 23:01 stale[bot]