felt / tippecanoe

Build vector tilesets from large collections of GeoJSON features.
BSD 2-Clause "Simplified" License
875 stars 76 forks source link

Unable to preserve elements at all zoom levels #226

Open jaanli opened 4 months ago

jaanli commented 4 months ago

This is my first time using Tippecanoe (with lots of help from Claude)...

I am trying to convert the following data from New York City:

wget https://s-media.nyc.gov/agencies/dcp/assets/files/zip/data-tools/bytes/nyc_mappluto_24v1_fgdb.zip -O /tmp/nyc_mappluto_24v1_fgdb.zip
unzip -o /tmp/nyc_mappluto_24v1_fgdb.zip -d ~/data/nyc_mappluto_24v1_fgdb

It looks like this:

image
import geopandas as gpd

file_path = "/Users/me/data/nyc_mappluto_24v1_fgdb/MapPLUTO24v1.gdb"
gdf = gpd.read_file(file_path)
gdf.plot(figsize=(10,10))

I've converted it to parquet with the appropriate coordinate reference system (the data is in NAD83 / New York Long Island (ftUS) EPSG:2263):

# Convert the coordinate system to WGS84/EPSG:4326
gdf = gdf.to_crs("EPSG:4326")

# Convert to Parquet
gdf.to_parquet("/Users/me/data/nyc_mappluto_24v1_fgdb/MapPLUTO24v1_wgs84.parquet")

And I have used gpq to convert it to geojson:

gpq convert "/Users/me/data/nyc_mappluto_24v1_fgdb/MapPLUTO24v1_wgs84.parquet" --to=geojson > ~/data/nyc_mappluto_24v1_fgdb/dataMapPLUTO24v1_wgs84.geojson

And tippecanoe to convert to newline-delimited GeoJSON for speed:

tippecanoe-json-tool ~/data/nyc_mappluto_24v1_fgdb/dataMapPLUTO24v1_wgs84.geojson > ~/data/nyc_mappluto_24v1_fgdb/dataMapPLUTO24v1_wgs84.nd.geojson

Now I am trying to use tippecanoe to preserve all of the information in an interactive pmtiles map:

!tippecanoe \
    --read-parallel \
    -o ./docs/data/new_york_real_estate_MapPLUTO_data_min_zoom_0_max_zoom_12.pmtiles \
    -Z0 -z12 \
    ~/data/nyc_mappluto_24v1_fgdb/dataMapPLUTO24v1_wgs84.geojson

However, the result shows nowhere near as much detail :(

image

The full notebook is here if needed: https://github.com/jaanli/new-york-real-estate/blob/main/notebooks/loading_visualizing_mapping_new_york_real_estate_data_in_python.ipynb

Any tips on how to solve this and generate a protomaps tileset with the full level of detail in the original data?

It's my first time using these tools, so I might have missed something basic here. Thank you for such a fast growing open source ecosystem here, super exciting!! (The next steps after involve linking this to Census data from tens of millions of people that I've already gotten working: https://jaanli.github.io/american-community-survey/new-york-area)