Skip to content

titiler-pgstac in R#491

Merged
HarshiniGirish merged 19 commits intoMAAP-Project:developfrom
HarshiniGirish:titiler-pgstac
Jul 17, 2025
Merged

titiler-pgstac in R#491
HarshiniGirish merged 19 commits intoMAAP-Project:developfrom
HarshiniGirish:titiler-pgstac

Conversation

@HarshiniGirish
Copy link
Collaborator

No description provided.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@HarshiniGirish HarshiniGirish changed the title initial_draft titiler-pgstac in R Apr 23, 2025
@HarshiniGirish
Copy link
Collaborator Author

@wildintellect @smk0033 @hrodmn @zacdezgeo can someone please review this notebook when you find time. I want to make the changes and close the ticket before I leave for my break. Thank you

@HarshiniGirish HarshiniGirish requested a review from hrodmn May 1, 2025 23:43
@review-notebook-app
Copy link

review-notebook-app bot commented May 2, 2025

View / edit / reply to this conversation on ReviewNB

hrodmn commented on 2025-05-02T11:22:44Z
----------------------------------------------------------------

If you just need the XYZ tile layer URL I would not reformat the WMTS url to get it - just use ak_tilejson$tiles instead!


Copy link
Contributor

@hrodmn hrodmn left a comment

Choose a reason for hiding this comment

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

@HarshiniGirish this looks really good! My only request is that you update the last section to use ak_tilejson$tiles instead of gsub-ing the WMTS url to get the XYZ tile URL.

@wildintellect
Copy link
Collaborator

🤔 do we want to make sure we can point people to WMTS urls if they wanted to use the tiles in QGIS? I think that would go in a different doc. I agree stick to simpler XYZ for Leaflet maps.

@review-notebook-app
Copy link

review-notebook-app bot commented May 2, 2025

View / edit / reply to this conversation on ReviewNB

wildintellect commented on 2025-05-02T22:42:41Z
----------------------------------------------------------------

Switch to httr2,make require some code updates further on.


@review-notebook-app
Copy link

review-notebook-app bot commented May 2, 2025

View / edit / reply to this conversation on ReviewNB

wildintellect commented on 2025-05-02T22:42:42Z
----------------------------------------------------------------

Line #7.    coords <- matrix(c(

I think this can be simplified by using st_bbox

https://gis.stackexchange.com/a/485194

which means the center can also be obtained with st_centroid


@HarshiniGirish
Copy link
Collaborator Author

@hrodmn @wildintellect thank you for the initial review, I have made the changes. Please let me know if anything has to be implemented going forward.

@wildintellect
Copy link
Collaborator

@hrodmn I assigned final review to you.

@review-notebook-app
Copy link

review-notebook-app bot commented Jul 10, 2025

View / edit / reply to this conversation on ReviewNB

hrodmn commented on 2025-07-10T02:18:17Z
----------------------------------------------------------------

Line #4.    response <- GET(url, timeout(10))

since you are using httr2 now, you need to update this to use httr2::request instead of GET - https://httr2.r-lib.org/


@review-notebook-app
Copy link

review-notebook-app bot commented Jul 10, 2025

View / edit / reply to this conversation on ReviewNB

hrodmn commented on 2025-07-10T02:18:17Z
----------------------------------------------------------------

Line #2.    collection_tilejson <- fromJSON(collection_tilejson, simplifyVector = TRUE)

We are skipping an important step here. To get the XYZ tile URL you need to send a request to the tilejson endpoint. You can get that link in a similar way to how you have it set up below:

tilejson_url <- collection_info$links[collection_info$links$rel == "tilejson", "href"]
tilejson_url <- gsub("\\{tileMatrixSetId\\}", "WebMercatorQuad", tilejson_url)

collection_tilejson <- request(tilejson_url)
...

@review-notebook-app
Copy link

review-notebook-app bot commented Jul 10, 2025

View / edit / reply to this conversation on ReviewNB

hrodmn commented on 2025-07-10T02:18:18Z
----------------------------------------------------------------

Line #5.    wmts_url <- ak_search_request$links[ak_search_request$links$rel == "wmts", "href"]

I know it is confusing how many different links are stuffed in here but we should just get the tilejson link here, then pull the tiles link from the tilejson response.


@HarshiniGirish
Copy link
Collaborator Author

Thanks for the review @hrodmn. I have made all the suggested changes. Please have a look at your convenience.

@review-notebook-app
Copy link

review-notebook-app bot commented Jul 14, 2025

View / edit / reply to this conversation on ReviewNB

hrodmn commented on 2025-07-14T20:12:43Z
----------------------------------------------------------------

Line #7.      rescale = paste(agb_raw$rescale[1, ], collapse = ",")  # e.g., "0,400"

can you add colormap_name = agb_raw$colormap_name?


@review-notebook-app
Copy link

review-notebook-app bot commented Jul 16, 2025

View / edit / reply to this conversation on ReviewNB

hrodmn commented on 2025-07-16T10:48:31Z
----------------------------------------------------------------

Line #8.      colormap_name = agb_raw$colormap_name

also need to add bidx=1 for the tiles to work correctly


@review-notebook-app
Copy link

review-notebook-app bot commented Jul 16, 2025

View / edit / reply to this conversation on ReviewNB

hrodmn commented on 2025-07-16T10:48:32Z
----------------------------------------------------------------

Line #22.        lng = st_coordinates(center)[1],

you will need to set this to center_lng and center_lat


@review-notebook-app
Copy link

review-notebook-app bot commented Jul 16, 2025

View / edit / reply to this conversation on ReviewNB

hrodmn commented on 2025-07-16T10:48:32Z
----------------------------------------------------------------

this whole cell can be deleted - you already requested the tilejson in the above cell


@review-notebook-app
Copy link

review-notebook-app bot commented Jul 16, 2025

View / edit / reply to this conversation on ReviewNB

hrodmn commented on 2025-07-16T10:48:33Z
----------------------------------------------------------------

Line #25.      setView(lng = center_lng, lat = center_lat, zoom = 6)

change this to setView(lng = ak_tilejson$center[1], lat = ak_tilejson$center[2])

the existing values of center_lng and center_lat are from the whole collection tilejson.


@hrodmn
Copy link
Contributor

hrodmn commented Jul 16, 2025

Thanks for making those changes @HarshiniGirish! I found a few more things that need to be addressed before we merge. You will also need to add an entry for the new notebook to docs/source/technical_tutorials/working_with_r.rst to make sure this notebook gets included when we rebuild the docs website.

It would be really helpful if you could make sure the notebook can be cleanly rendered from top to bottom (run all cells) after restarting the kernel - that is what is going to happen when we merge the PR and rebuild the docs site so we need to make sure that each notebook can be rendered cleanly without any errors!

@HarshiniGirish
Copy link
Collaborator Author

Thank you @hrodmn. Please let me know if anything else has to be addressed!

@hrodmn
Copy link
Contributor

hrodmn commented Jul 16, 2025

@HarshiniGirish the notebook will not render for me with a fresh kernel - need to define center_lng and center_lat before using them in the first leaflet map

@HarshiniGirish
Copy link
Collaborator Author

My bad. missed it earlier. I made the update, please try again @hrodmn

@review-notebook-app
Copy link

review-notebook-app bot commented Jul 16, 2025

View / edit / reply to this conversation on ReviewNB

hrodmn commented on 2025-07-16T15:16:06Z
----------------------------------------------------------------

Line #25.        lng = center_lng,

this variable is not defined yet!


@HarshiniGirish
Copy link
Collaborator Author

thank you @hrodmn made the change. Not sure it is what you were looking for. I apologize for the disorder here

@review-notebook-app
Copy link

review-notebook-app bot commented Jul 16, 2025

View / edit / reply to this conversation on ReviewNB

hrodmn commented on 2025-07-16T17:54:57Z
----------------------------------------------------------------

If you make this a level 1 header instead of a level 2 header, it will be used for the article's title in the docs website


@review-notebook-app
Copy link

review-notebook-app bot commented Jul 16, 2025

View / edit / reply to this conversation on ReviewNB

hrodmn commented on 2025-07-16T17:54:58Z
----------------------------------------------------------------

Please add a space between the name and affiliation (e.g. Harshini Girish (UAH))


@hrodmn
Copy link
Contributor

hrodmn commented Jul 16, 2025

Thanks for your patience with my review @HarshiniGirish! I found a few small things at the very top but the notebook renders beautifully now without any errors. Once you take care of the the markdown edits at the top and rename the notebook without spaces I'll approve it and you can merge this PR 🚀

@HarshiniGirish
Copy link
Collaborator Author

Thank you @hrodmn! made the updates!

@hrodmn hrodmn self-requested a review July 16, 2025 20:09
Copy link
Contributor

@hrodmn hrodmn left a comment

Choose a reason for hiding this comment

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

Looks great - thanks @HarshiniGirish

@HarshiniGirish HarshiniGirish merged commit 083fe69 into MAAP-Project:develop Jul 17, 2025
@HarshiniGirish HarshiniGirish deleted the titiler-pgstac branch July 17, 2025 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants