Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
gisxuh opened this issue Sep 12, 2024 · 4 comments

Comments

@gisxuh
Copy link

gisxuh commented Sep 12, 2024

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
Copy link
Member

songyumeng commented Sep 13, 2024

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
Copy link
Author

gisxuh commented Sep 14, 2024

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
Copy link
Member

TMS services and 3D buildings is supported.

@songyumeng
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants