-
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 7 replies
-
I am waiting for ipyleaflet to merge my pull request for adding pmtiles support. See jupyter-widgets/ipyleaflet#1138 For the time being, use the folium backend import leafmap.foliumap as leafmap |
Beta Was this translation helpful? Give feedback.
-
The example code you shared in the tutorial works fine on my local jupyter notebook, but the PMTiles data I uploaded to my own server is not working for some reason. Below is the code that I used. Any chance that you see some obvious errors in my code?
import leafmap.foliumap as leafmap
url = 'https://lidar.digitalforestry.org/vt/in/2022/IN2022-County_Boundaries.pmtiles'
metadata = leafmap.pmtiles_metadata(url)
print(f"layer names: {metadata['layer_names']}")
print(f"bounds: {metadata['bounds']}")
m = leafmap.Map(center=[20, 0], zoom=2, height='800px')
m.add_basemap('CartoDB.DarkMatter')
m.add_basemap('Esri.WorldImagery', show=False)
style = {
"version": 8,
"sources": {
"example_source": {
"type": "vector",
"url": "pmtiles://" + url,
"attribution": 'PMTiles',
}
},
"layers": [
{
"id": "buildings",
"source": "example_source",
"source-layer": "in2022_county_boundaries",
"type": "fill",
"paint": {"fill-color": "#3388ff", "fill-opacity": 0.5},
},
],
}
m.add_pmtiles(
url, name='Indiana Parcels 2022', style=style, overlay=True, show=True, zoom_to_layer=False
)
m
This shows me a map but it does not load the vector layer. ☹
Best Regards,
Jinha Jung
Associate Professor
Lyles School of Civil Engineering
Delon and Elizabeth Hampton Hall of Civil Engineering
Purdue University
550 Stadium Mall Drive
West Lafayette, IN 47907-2051
***@***.******@***.***> | 765-496-1267
https://gdsl.org<https://gdsl.org/>
[signature_2422129063]<https://engineering.purdue.edu/CE>[facebook-icon]<https://www.facebook.com/PurdueCE>[twitter-icon]<https://twitter.com/PurdueCE>[twitter-icon]<https://www.youtube.com/channel/UCUItx8DqEeysf9QTdFDvvfg/feed>
[signature_2629605815]
Together, We Build.
From: Qiusheng Wu ***@***.***>
Date: Friday, November 10, 2023 at 1:51 PM
To: opengeos/leafmap ***@***.***>
Cc: Jung, Jinha ***@***.***>, Author ***@***.***>
Subject: Re: [opengeos/leafmap] module 'ipyleaflet' has no attribute 'PMTilesLayer' (Discussion #597)
---- External Email: Use caution with attachments, links, or sharing data ----
ipyleaflet installation is a bit tricky. Try creating a fresh conda env to install it.
The folium backend should work. Try the notebook example before using your own data. See
https://leafmap.org/notebooks/82_pm tiles
—
Reply to this email directly, view it on GitHub<#597 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AABBNTDOCURQGFWIZORSA33YDZZSBAVCNFSM6AAAAAA7GRWCTWVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TKMZWGYYTK>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
It does support RANGE request as I am using this server to host other COG files. Looking at the network tab, it seems that “CORS” is causing this issue. Probably, this will be a server setting I need to update. I will look into further and keep you posted.
Best Regards,
Jinha Jung
Associate Professor
Lyles School of Civil Engineering
Delon and Elizabeth Hampton Hall of Civil Engineering
Purdue University
550 Stadium Mall Drive
West Lafayette, IN 47907-2051
***@***.******@***.***> | 765-496-1267
https://gdsl.org<https://gdsl.org/>
[signature_2422129063]<https://engineering.purdue.edu/CE>[facebook-icon]<https://www.facebook.com/PurdueCE>[twitter-icon]<https://twitter.com/PurdueCE>[twitter-icon]<https://www.youtube.com/channel/UCUItx8DqEeysf9QTdFDvvfg/feed>
[signature_2629605815]
Together, We Build.
From: Qiusheng Wu ***@***.***>
Date: Friday, November 10, 2023 at 2:58 PM
To: opengeos/leafmap ***@***.***>
Cc: Jung, Jinha ***@***.***>, Author ***@***.***>
Subject: Re: [opengeos/leafmap] module 'ipyleaflet' has no attribute 'PMTilesLayer' (Discussion #597)
---- External Email: Use caution with attachments, links, or sharing data ----
Does your server support http range requests? Open the browser network tab. You might see some errors there indicating why it is not working
—
Reply to this email directly, view it on GitHub<#597 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AABBNTHNFBXUVPUK2S3N7D3YD2BOFAVCNFSM6AAAAAA7GRWCTWVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TKMZXGAYDC>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Indeed, it was the CORS setting on the server side was the cause of the issue. I updated my web server setting and everything is working like a charm. 😊 Thank you so much!
Best Regards,
Jinha Jung
Associate Professor
Lyles School of Civil Engineering
Delon and Elizabeth Hampton Hall of Civil Engineering
Purdue University
550 Stadium Mall Drive
West Lafayette, IN 47907-2051
***@***.******@***.***> | 765-496-1267
https://gdsl.org<https://gdsl.org/>
[signature_2422129063]<https://engineering.purdue.edu/CE>[facebook-icon]<https://www.facebook.com/PurdueCE>[twitter-icon]<https://twitter.com/PurdueCE>[twitter-icon]<https://www.youtube.com/channel/UCUItx8DqEeysf9QTdFDvvfg/feed>
[signature_2629605815]
Together, We Build.
From: Jung, Jinha ***@***.***>
Date: Friday, November 10, 2023 at 3:13 PM
To: opengeos/leafmap ***@***.***>, opengeos/leafmap ***@***.***>
Cc: Author ***@***.***>
Subject: Re: [opengeos/leafmap] module 'ipyleaflet' has no attribute 'PMTilesLayer' (Discussion #597)
It does support RANGE request as I am using this server to host other COG files. Looking at the network tab, it seems that “CORS” is causing this issue. Probably, this will be a server setting I need to update. I will look into further and keep you posted.
Best Regards,
Jinha Jung
Associate Professor
Lyles School of Civil Engineering
Delon and Elizabeth Hampton Hall of Civil Engineering
Purdue University
550 Stadium Mall Drive
West Lafayette, IN 47907-2051
***@***.******@***.***> | 765-496-1267
https://gdsl.org<https://gdsl.org/>
[signature_2422129063]<https://engineering.purdue.edu/CE>[facebook-icon]<https://www.facebook.com/PurdueCE>[twitter-icon]<https://twitter.com/PurdueCE>[twitter-icon]<https://www.youtube.com/channel/UCUItx8DqEeysf9QTdFDvvfg/feed>
[signature_2629605815]
Together, We Build.
From: Qiusheng Wu ***@***.***>
Date: Friday, November 10, 2023 at 2:58 PM
To: opengeos/leafmap ***@***.***>
Cc: Jung, Jinha ***@***.***>, Author ***@***.***>
Subject: Re: [opengeos/leafmap] module 'ipyleaflet' has no attribute 'PMTilesLayer' (Discussion #597)
---- External Email: Use caution with attachments, links, or sharing data ----
Does your server support http range requests? Open the browser network tab. You might see some errors there indicating why it is not working
—
Reply to this email directly, view it on GitHub<#597 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AABBNTHNFBXUVPUK2S3N7D3YD2BOFAVCNFSM6AAAAAA7GRWCTWVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TKMZXGAYDC>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
It is indeed very fun! Ben is setting up a jupyter hub on our server and we will create an account for you so that we can develop some tutorial notebooks together. I will keep you posted. Safe travel!
Best Regards,
Jinha Jung
Associate Professor
Lyles School of Civil Engineering
Delon and Elizabeth Hampton Hall of Civil Engineering
Purdue University
550 Stadium Mall Drive
West Lafayette, IN 47907-2051
***@***.******@***.***> | 765-496-1267
https://gdsl.org<https://gdsl.org/>
[signature_2422129063]<https://engineering.purdue.edu/CE>[facebook-icon]<https://www.facebook.com/PurdueCE>[twitter-icon]<https://twitter.com/PurdueCE>[twitter-icon]<https://www.youtube.com/channel/UCUItx8DqEeysf9QTdFDvvfg/feed>
[signature_2629605815]
Together, We Build.
From: Qiusheng Wu ***@***.***>
Date: Friday, November 10, 2023 at 3:22 PM
To: opengeos/leafmap ***@***.***>
Cc: Jung, Jinha ***@***.***>, Author ***@***.***>
Subject: Re: [opengeos/leafmap] module 'ipyleaflet' has no attribute 'PMTilesLayer' (Discussion #597)
---- External Email: Use caution with attachments, links, or sharing data ----
Great to hear that you got it resolved! Enjoy the visualization of large vector datasets with PMTiles
—
Reply to this email directly, view it on GitHub<#597 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AABBNTEM7HQIC6VYCYPV34LYD2EJ3AVCNFSM6AAAAAA7GRWCTWVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TKMZXGEZTS>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
I am waiting for ipyleaflet to merge my pull request for adding pmtiles support. See jupyter-widgets/ipyleaflet#1138
For the time being, use the folium backend
import leafmap.foliumap as leafmap