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

try proj4leaflet to support projection in /map viewer #560

Merged
merged 6 commits into from
Dec 14, 2022

Conversation

vincentsarago
Copy link
Member

closes #559

'{{ tms.crs.to_proj4() }}', {
origin: [{{ tms.xy_bbox[0] }}, {{ tms.xy_bbox[3] }}],
// bounds: [[{{ tms.xy_bbox[0] }}, {{ tms.xy_bbox[1] }}], [{{ tms.xy_bbox[2] }}, {{ tms.xy_bbox[3] }}]],
resolutions: {{ resolutions|safe }},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ need help here ⚠️

It seems to work but it needs more testing

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is a bit tricky. I'll quote myself from https://gis.stackexchange.com/a/423647/53755 :

The result of L.CRS.scale() has to be multiplied by a CRS-dependant constant (the world bounds according to that CRS) in order to make the numbers meaningful, which IMO leads to confusion.

So you have to be careful about the CRS's bounds, specially if you plan on using TMS-style tiles with an inverted Y-coordinate (a {-y} in the URL template). Specifically, see https://stackoverflow.com/a/62625435/4768502

See also https://gis.stackexchange.com/a/310124/53755 - Don't be confused when using Leaflet's functions for projecting/unprojecting coordinates because they don't rely on CRS-relative numbers, but rather screen-relative numbers.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for you help @IvanSanchez
going back at this today, and I'm not quite sure I understand all of ☝️ 😭

@vincentsarago vincentsarago self-assigned this Dec 9, 2022
@vincentsarago vincentsarago added enhancement New feature or request help wanted Extra attention is needed labels Dec 9, 2022
@vincentsarago vincentsarago changed the title try proj4leaflet to support projection in viewew try proj4leaflet to support projection in /map viewer Dec 9, 2022
data.tiles[0], {
minZoom: data.minzoom,
maxZoom: data.maxzoom,
bounds: L.latLngBounds([bottom, left], [top, right]),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you want to do this - the bounds option on a L.Tilelayer is a constraint, so the tilelayer will load less tiles. It's not an informative field.

Focus on getting the bounds of the Leaflet CRS right - tilelayers will work throughout that range, and only throughout that range.

@vincentsarago
Copy link
Member Author

🥳 adding the markers really help 🙏 @IvanSanchez

I can now see which TMS are 🙅 👇
Screen Shot 2022-12-09 at 6 20 34 PM
Screen Shot 2022-12-09 at 6 20 51 PM
Screen Shot 2022-12-09 at 6 17 50 PM
Screen Shot 2022-12-09 at 6 18 09 PM
Screen Shot 2022-12-09 at 6 18 53 PM
Screen Shot 2022-12-09 at 6 19 18 PM
Screen Shot 2022-12-09 at 6 19 49 PM
Screen Shot 2022-12-09 at 6 20 12 PM
Screen Shot 2022-12-09 at 6 17 04 PM
Screen Shot 2022-12-09 at 6 16 51 PM
Screen Shot 2022-12-09 at 6 16 40 PM

@vincentsarago
Copy link
Member Author

Alright everything seems to work well 🥳

notes:

  • CanadianNAD83_LCC does not work but I highly suspect the TMS of not being good
  • NZTM2000 does not work but I highly suspect the TMS of not being good ame as ☝️
  • NZTM2000Quad also gives weird results
  • UTM31WGS84Quad does not I highly suspect the TMS of not being good

@vincentsarago vincentsarago merged commit 5588da0 into master Dec 14, 2022
@vincentsarago vincentsarago deleted the mapViewerLeafletTMS branch December 14, 2022 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support multiple TMS in /map viewer
2 participants