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

Fix Elevation API and extend Elevation Preview #1432

Merged
merged 7 commits into from
Jan 10, 2025

Conversation

okimiko
Copy link
Contributor

@okimiko okimiko commented Jan 7, 2025

I added a Info field to the elevation preview, which queries the elevation api with coordinates.

During the implementation I stumbled over various issues:

  • pmtile coordinates weren't working (just tiles)
  • pixel calculation was not working
  • swapped lat / long in coordinate input
  • use of static tileSize is not a good idea
  • the limitation by zoom is not needed for coordinate api

Miko added 2 commits January 8, 2025 00:17
- pmtile coordinates
- pixel calculation
- swapped lat / long
- allow tileSize to be configured
- allow any zoom for coordinates
public/resources/elevation-control.js Dismissed Show dismissed Hide dismissed
src/serve_data.js Fixed Show fixed Hide fixed
@okimiko okimiko marked this pull request as draft January 7, 2025 23:44

map.addControl(
new ElevationInfoControl({
url: baseUrl + "/data/{{id}}/elevation/{z}/{x}/{y}"
Copy link
Collaborator

@acalcutt acalcutt Jan 8, 2025

Choose a reason for hiding this comment

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

Instead of adding baseUrl do you think you can use {{public_url}} like the javascript links in the header

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

It's ok, you probably got the baseUrl thing from the contour test I posted :-) I didn't think of that then..haha

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct, it's still in my PR to your PR ;-)

@acalcutt
Copy link
Collaborator

acalcutt commented Jan 9, 2025

I tested this and notice two issue.

1.) I saw a lot of no data returns, especially around Australia when it was off center to the left of the map. possible when passing the antimeridian

2.) I noticed this issue from before where the terrain window seems to have a white line on the left side.
image

I changed
#map { position:absolute; top:0; bottom:0; width:100%; }
to
#map {position:absolute;top:0;left:0;right:0;bottom:0;}
in the data.tmpl and it seemed to fix it.

@okimiko
Copy link
Contributor Author

okimiko commented Jan 9, 2025

I tested this and notice two issue.

1.) I saw a lot of no data returns, especially around Australia when it was off center to the left of the map. possible when passing the antimeridian

2.) I noticed this issue from before where the terrain window seems to have a white line on the left side.

I changed #map { position:absolute; top:0; bottom:0; width:100%; } to #map {position:absolute;top:0;left:0;right:0;bottom:0;} in the data.tmpl and it seemed to fix it.

  1. Correct, the bounds check was hit there. I removed it and the coordinate conversion works (and the elevation api) works as expected.
  2. Fixed, too.

Copy link
Collaborator

@acalcutt acalcutt left a comment

Choose a reason for hiding this comment

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

looks good to me now

@acalcutt acalcutt marked this pull request as ready for review January 10, 2025 15:51
@acalcutt acalcutt merged commit 4a78344 into maptiler:master Jan 10, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants