diff --git a/docs/data/new_york_real_estate_MapPLUTO_data_min_zoom_0_max_zoom_12.pmtiles b/docs/data/new_york_real_estate_MapPLUTO_data_min_zoom_0_max_zoom_12.pmtiles index 4b513de..127f6c1 100644 Binary files a/docs/data/new_york_real_estate_MapPLUTO_data_min_zoom_0_max_zoom_12.pmtiles and b/docs/data/new_york_real_estate_MapPLUTO_data_min_zoom_0_max_zoom_12.pmtiles differ diff --git a/docs/data/new_york_real_estate_MapPLUTO_data_ndjson_min_zoom_0_max_zoom_12_notilesizelimit.pmtiles b/docs/data/new_york_real_estate_MapPLUTO_data_ndjson_min_zoom_0_max_zoom_12_notilesizelimit.pmtiles new file mode 100644 index 0000000..809bd18 Binary files /dev/null and b/docs/data/new_york_real_estate_MapPLUTO_data_ndjson_min_zoom_0_max_zoom_12_notilesizelimit.pmtiles differ diff --git a/docs/full.md b/docs/full.md new file mode 100644 index 0000000..18697b3 --- /dev/null +++ b/docs/full.md @@ -0,0 +1,161 @@ +--- +toc: false +--- + + + +
+

New York Real Estate

+

Welcome to interactive visualizations of New York City real estate data! +

+ + +```js +const center = [40.7,-74]; +const zoom = 9.5; +``` + +```js +const areas = FileAttachment("data/new_york_real_estate_MapPLUTO_data_ndjson_min_zoom_0_max_zoom_12_notilesizelimit.pmtiles"); +``` + +```js +import maplibregl from "npm:maplibre-gl@4.0.2"; +import { PMTiles, Protocol } from "npm:pmtiles@3.0.3"; +const protocol = new Protocol(); +maplibregl.addProtocol("pmtiles",protocol.tile); +``` + + + +```js +const div = display(document.createElement("div")); +div.style = "height: 400px;"; +const map = new maplibregl.Map({ + container: div, + zoom: zoom - 1, + center: [center[1],center[0]], + style: "https://api.protomaps.com/styles/v2/black.json?key=7c0c24912bd59a0f" +}) + +map.on("load", () => { + map.addSource("dataMapPLUTO24v1_wgs84", { + type: "vector", + url: `pmtiles://${areas.href}` + }) + + map.addLayer({ + "id":"dataMapPLUTO24v1_wgs84", + "source": "dataMapPLUTO24v1_wgs84", + "source-layer":"dataMapPLUTO24v1_wgs84", + "type": "fill", + "paint": { + "fill-color": [ + "case", + ['boolean', ['feature-state', 'hover'], false], + "red", + "steelblue" + ], + "fill-opacity": 0.7 + } + }) + + map.addLayer({ + "id":"dataMapPLUTO24v1_wgs84_stroke", + "source": "dataMapPLUTO24v1_wgs84", + "source-layer":"dataMapPLUTO24v1_wgs84", + "type": "line", + "paint": { + "line-color": "cyan", + "line-width": 0.2 + } + }) + + let hoveredId = null; + + const popup = new maplibregl.Popup({ + closeButton: false, + closeOnClick: false + }); + + map.on('mousemove', 'dataMapPLUTO24v1_wgs84', (e) => { + + if (e.features.length > 0) { + map.getCanvas().style.cursor = 'pointer'; + const props = e.features[0].properties; + let result = ''; + for (let key in props) { + if (props.hasOwnProperty(key)) { + result += key + ': ' + props[key] + '
'; + } + } + popup.setLngLat(e.lngLat).setHTML(result).addTo(map); + + if (hoveredId) { + map.setFeatureState( + {source: 'dataMapPLUTO24v1_wgs84', sourceLayer: "dataMapPLUTO24v1_wgs84", id: hoveredId}, + {hover: false} + ); + } + hoveredId = e.features[0].id; + map.setFeatureState( + {source: 'dataMapPLUTO24v1_wgs84', sourceLayer: "dataMapPLUTO24v1_wgs84", id: hoveredId}, + {hover: true} + ); + } + }); + + map.on('mouseleave', 'dataMapPLUTO24v1_wgs84', () => { + map.getCanvas().style.cursor = ''; + popup.remove(); + + if (hoveredId) { + map.setFeatureState( + {source: 'dataMapPLUTO24v1_wgs84', sourceLayer: "dataMapPLUTO24v1_wgs84", id: hoveredId}, + {hover: false} + ); + } + hoveredId = null; + }); +}) +``` diff --git a/notebooks/loading_visualizing_mapping_new_york_real_estate_data_in_python.ipynb b/notebooks/loading_visualizing_mapping_new_york_real_estate_data_in_python.ipynb index 7a724de..b1ca716 100644 --- a/notebooks/loading_visualizing_mapping_new_york_real_estate_data_in_python.ipynb +++ b/notebooks/loading_visualizing_mapping_new_york_real_estate_data_in_python.ipynb @@ -79,9 +79,29 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "metadata": {}, - "outputs": [], + "outputs": [ + { + "ename": "KeyboardInterrupt", + "evalue": "", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[1], line 4\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mgeopandas\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mgpd\u001b[39;00m\n\u001b[1;32m 3\u001b[0m file_path \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m/Users/me/data/nyc_mappluto_24v1_fgdb/MapPLUTO24v1.gdb\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m----> 4\u001b[0m gdf \u001b[38;5;241m=\u001b[39m \u001b[43mgpd\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mread_file\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfile_path\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/jaanli/new-york-real-estate/.venv/lib/python3.12/site-packages/geopandas/io/file.py:297\u001b[0m, in \u001b[0;36m_read_file\u001b[0;34m(filename, bbox, mask, rows, engine, **kwargs)\u001b[0m\n\u001b[1;32m 294\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 295\u001b[0m path_or_bytes \u001b[38;5;241m=\u001b[39m filename\n\u001b[0;32m--> 297\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43m_read_file_fiona\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 298\u001b[0m \u001b[43m \u001b[49m\u001b[43mpath_or_bytes\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfrom_bytes\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mbbox\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mbbox\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmask\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mrows\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrows\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\n\u001b[1;32m 299\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 301\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 302\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124munknown engine \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mengine\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n", + "File \u001b[0;32m~/jaanli/new-york-real-estate/.venv/lib/python3.12/site-packages/geopandas/io/file.py:395\u001b[0m, in \u001b[0;36m_read_file_fiona\u001b[0;34m(path_or_bytes, from_bytes, bbox, mask, rows, where, **kwargs)\u001b[0m\n\u001b[1;32m 391\u001b[0m df \u001b[38;5;241m=\u001b[39m pd\u001b[38;5;241m.\u001b[39mDataFrame(\n\u001b[1;32m 392\u001b[0m [record[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mproperties\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;28;01mfor\u001b[39;00m record \u001b[38;5;129;01min\u001b[39;00m f_filt], columns\u001b[38;5;241m=\u001b[39mcolumns\n\u001b[1;32m 393\u001b[0m )\n\u001b[1;32m 394\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 395\u001b[0m df \u001b[38;5;241m=\u001b[39m \u001b[43mGeoDataFrame\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfrom_features\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 396\u001b[0m \u001b[43m \u001b[49m\u001b[43mf_filt\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcrs\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcrs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcolumns\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcolumns\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m+\u001b[39;49m\u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mgeometry\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\n\u001b[1;32m 397\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 398\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m k \u001b[38;5;129;01min\u001b[39;00m datetime_fields:\n\u001b[1;32m 399\u001b[0m as_dt \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", + "File \u001b[0;32m~/jaanli/new-york-real-estate/.venv/lib/python3.12/site-packages/geopandas/geodataframe.py:638\u001b[0m, in \u001b[0;36mGeoDataFrame.from_features\u001b[0;34m(cls, features, crs, columns)\u001b[0m\n\u001b[1;32m 635\u001b[0m rows \u001b[38;5;241m=\u001b[39m []\n\u001b[1;32m 636\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m feature \u001b[38;5;129;01min\u001b[39;00m features_lst:\n\u001b[1;32m 637\u001b[0m \u001b[38;5;66;03m# load geometry\u001b[39;00m\n\u001b[0;32m--> 638\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28;43mhasattr\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mfeature\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m__geo_interface__\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m:\n\u001b[1;32m 639\u001b[0m feature \u001b[38;5;241m=\u001b[39m feature\u001b[38;5;241m.\u001b[39m__geo_interface__\n\u001b[1;32m 640\u001b[0m row \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 641\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mgeometry\u001b[39m\u001b[38;5;124m\"\u001b[39m: shape(feature[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mgeometry\u001b[39m\u001b[38;5;124m\"\u001b[39m]) \u001b[38;5;28;01mif\u001b[39;00m feature[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mgeometry\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 642\u001b[0m }\n", + "File \u001b[0;32m~/jaanli/new-york-real-estate/.venv/lib/python3.12/site-packages/fiona/model.py:367\u001b[0m, in \u001b[0;36mFeature.__geo_interface__\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 365\u001b[0m \u001b[38;5;129m@property\u001b[39m\n\u001b[1;32m 366\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__geo_interface__\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[0;32m--> 367\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mObjectEncoder\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdefault\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/jaanli/new-york-real-estate/.venv/lib/python3.12/site-packages/fiona/model.py:388\u001b[0m, in \u001b[0;36mObjectEncoder.default\u001b[0;34m(self, o)\u001b[0m\n\u001b[1;32m 386\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mdefault\u001b[39m(\u001b[38;5;28mself\u001b[39m, o):\n\u001b[1;32m 387\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(o, Object):\n\u001b[0;32m--> 388\u001b[0m o_dict \u001b[38;5;241m=\u001b[39m {k: \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdefault\u001b[49m\u001b[43m(\u001b[49m\u001b[43mv\u001b[49m\u001b[43m)\u001b[49m \u001b[38;5;28;01mfor\u001b[39;00m k, v \u001b[38;5;129;01min\u001b[39;00m o\u001b[38;5;241m.\u001b[39mitems()}\n\u001b[1;32m 389\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(o, Geometry):\n\u001b[1;32m 390\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m o\u001b[38;5;241m.\u001b[39mtype \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mGeometryCollection\u001b[39m\u001b[38;5;124m\"\u001b[39m:\n", + "File \u001b[0;32m~/jaanli/new-york-real-estate/.venv/lib/python3.12/site-packages/fiona/model.py:388\u001b[0m, in \u001b[0;36mObjectEncoder.default\u001b[0;34m(self, o)\u001b[0m\n\u001b[1;32m 386\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mdefault\u001b[39m(\u001b[38;5;28mself\u001b[39m, o):\n\u001b[1;32m 387\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(o, Object):\n\u001b[0;32m--> 388\u001b[0m o_dict \u001b[38;5;241m=\u001b[39m \u001b[43m{\u001b[49m\u001b[43mk\u001b[49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdefault\u001b[49m\u001b[43m(\u001b[49m\u001b[43mv\u001b[49m\u001b[43m)\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mfor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mk\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mv\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01min\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mo\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mitems\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m}\u001b[49m\n\u001b[1;32m 389\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(o, Geometry):\n\u001b[1;32m 390\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m o\u001b[38;5;241m.\u001b[39mtype \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mGeometryCollection\u001b[39m\u001b[38;5;124m\"\u001b[39m:\n", + "File \u001b[0;32m:894\u001b[0m, in \u001b[0;36m__iter__\u001b[0;34m(self)\u001b[0m\n", + "File \u001b[0;32m~/jaanli/new-york-real-estate/.venv/lib/python3.12/site-packages/fiona/model.py:139\u001b[0m, in \u001b[0;36mObject.__getitem__\u001b[0;34m(self, item)\u001b[0m\n\u001b[1;32m 137\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__getitem__\u001b[39m(\u001b[38;5;28mself\u001b[39m, item):\n\u001b[1;32m 138\u001b[0m props \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_props()\n\u001b[0;32m--> 139\u001b[0m \u001b[43mprops\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mupdate\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_data\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 140\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m props[item]\n", + "\u001b[0;31mKeyboardInterrupt\u001b[0m: " + ] + } + ], "source": [ "import geopandas as gpd\n", "\n", @@ -91,7 +111,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -475,7 +495,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -505,7 +525,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -546,7 +566,7 @@ }, { "cell_type": "code", - "execution_count": 58, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -555,14 +575,14 @@ }, { "cell_type": "code", - "execution_count": 59, + "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "-rw-r--r-- 1 me staff 1.5G Apr 1 12:06 /Users/me/data/nyc_mappluto_24v1_fgdb/dataMapPLUTO24v1_wgs84.geojson\n" + "-rw-r--r--@ 1 me staff 1.5G Apr 13 10:29 /Users/me/data/nyc_mappluto_24v1_fgdb/dataMapPLUTO24v1_wgs84.geojson\n" ] } ], @@ -581,7 +601,7 @@ }, { "cell_type": "code", - "execution_count": 67, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -590,14 +610,14 @@ }, { "cell_type": "code", - "execution_count": 68, + "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "-rw-r--r-- 1 me staff 1.5G Apr 1 12:19 /Users/me/data/nyc_mappluto_24v1_fgdb/dataMapPLUTO24v1_wgs84.nd.geojson\n" + "-rw-r--r-- 1 me staff 1.5G Apr 13 10:30 /Users/me/data/nyc_mappluto_24v1_fgdb/dataMapPLUTO24v1_wgs84.nd.geojson\n" ] } ], @@ -655,7 +675,7 @@ }, { "cell_type": "code", - "execution_count": 93, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -688,19 +708,20 @@ " --read-parallel \\\n", " -o ./docs/data/new_york_real_estate_MapPLUTO_data_min_zoom_0_max_zoom_12.pmtiles \\\n", " -Z0 -z12 \\\n", - " ~/data/nyc_mappluto_24v1_fgdb/dataMapPLUTO24v1_wgs84.geojson" + " ~/data/nyc_mappluto_24v1_fgdb/dataMapPLUTO24v1_wgs84.geojson \\\n", + " --force" ] }, { "cell_type": "code", - "execution_count": 94, + "execution_count": 10, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "-rw-r--r-- 1 me staff 2.4M Apr 1 13:32 ./docs/data/new_york_real_estate_MapPLUTO_data_min_zoom_0_max_zoom_12.pmtiles\n" + "-rw-r--r-- 1 me staff 2.4M Apr 13 10:34 ./docs/data/new_york_real_estate_MapPLUTO_data_min_zoom_0_max_zoom_12.pmtiles\n" ] } ], @@ -708,6 +729,178 @@ "!ls -lh ./docs/data/new_york_real_estate_MapPLUTO_data_min_zoom_0_max_zoom_12.pmtiles" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Try conversion in parallel\n", + "\n", + "Speeds up by ~20%!" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "For layer 0, using name \"dataMapPLUTO24v1_wgs84nd\"\n", + "856813 features, 376948278 bytes of geometry and attributes, 83828872 bytes of string pool, 0 bytes of vertices, 0 bytes of nodes\n", + "tile 6/18/24 size is 1339555 with detail 12, >500000 \n", + "tile 7/37/48 size is 4203660 with detail 12, >500000 \n", + "tile 7/37/48 size is 1339433 with detail 11, >500000 \n", + "tile 8/75/96 size is 12607531 with detail 12, >500000 \n", + "tile 8/75/96 size is 4201398 with detail 11, >500000 \n", + "tile 8/75/96 size is 1338888 with detail 10, >500000 \n", + "tile 9/151/192 size is 9893082 with detail 12, >500000 \n", + "tile 9/151/192 size is 3296498 with detail 11, >500000 \n", + "tile 9/151/192 size is 1081552 with detail 10, >500000 \n", + "tile 9/150/192 has 255751 features, >200000 \n", + "Try using --drop-fraction-as-needed or --drop-densest-as-needed.\n", + "\n", + "\n", + "\n", + "*** NOTE TILES ONLY COMPLETE THROUGH ZOOM 8 ***\n", + " 100.0% 9/151/192 \r" + ] + } + ], + "source": [ + "!tippecanoe \\\n", + " --read-parallel \\\n", + " -o ./docs/data/new_york_real_estate_MapPLUTO_data_ndjson_min_zoom_0_max_zoom_12.pmtiles \\\n", + " -Z0 -z12 \\\n", + " ~/data/nyc_mappluto_24v1_fgdb/dataMapPLUTO24v1_wgs84.nd.geojson \\\n", + " --force" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "-rw-r--r-- 1 me staff 2.4M Apr 13 10:34 ./docs/data/new_york_real_estate_MapPLUTO_data_min_zoom_0_max_zoom_12.pmtiles\n" + ] + } + ], + "source": [ + "!ls -lh ./docs/data/new_york_real_estate_MapPLUTO_data_min_zoom_0_max_zoom_12.pmtiles" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Revise the conversion to Protomaps PMTiles format to preserve as much detail as feasible\n", + "\n", + "Constraints: GitHub file size limit of 100 MB." + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "For layer 0, using name \"dataMapPLUTO24v1_wgs84nd\"\n", + "856813 features, 403413324 bytes of geometry and attributes, 83828872 bytes of string pool, 0 bytes of vertices, 0 bytes of nodes\n", + "Choosing a maxzoom of -z12 for features typically 75 feet (23 meters) apart, and at least 22 feet (7 meters) apart\n", + " 99.3% 12/1208/1541 \n", + " 100.0% 12/1203/1543 \r" + ] + } + ], + "source": [ + "!tippecanoe \\\n", + " --read-parallel \\\n", + " -o ./docs/data/new_york_real_estate_MapPLUTO_data_ndjson_min_zoom_0_max_zoom_g.pmtiles \\\n", + " -Z0 -zg \\\n", + " -D8 \\\n", + " --drop-densest-as-needed \\\n", + " --extend-zooms-if-still-dropping \\\n", + " --generate-ids \\\n", + " --no-tile-compression \\\n", + " --no-feature-limit \\\n", + " --no-tile-size-limit \\\n", + " ~/data/nyc_mappluto_24v1_fgdb/dataMapPLUTO24v1_wgs84.nd.geojson \\\n", + " --force" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "-rw-r--r-- 1 me staff 344M Apr 13 10:47 ./docs/data/new_york_real_estate_MapPLUTO_data_ndjson_min_zoom_0_max_zoom_g.pmtiles\n" + ] + } + ], + "source": [ + "!ls -lh ./docs/data/new_york_real_estate_MapPLUTO_data_ndjson_min_zoom_0_max_zoom_g.pmtiles" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "For layer 0, using name \"dataMapPLUTO24v1_wgs84nd\"\n", + "856813 features, 399984707 bytes of geometry and attributes, 83828872 bytes of string pool, 0 bytes of vertices, 0 bytes of nodes\n", + " 99.9% 11/603/770 \n", + " 100.0% 11/601/771 \r" + ] + } + ], + "source": [ + "# remove no-tile-compression\n", + "!tippecanoe \\\n", + " --read-parallel \\\n", + " -o ./docs/data/new_york_real_estate_MapPLUTO_data_ndjson_min_zoom_0_max_zoom_12_notilesizelimit.pmtiles \\\n", + " -Z0 -z11 \\\n", + " -D8 \\\n", + " --drop-densest-as-needed \\\n", + " --extend-zooms-if-still-dropping \\\n", + " --generate-ids \\\n", + " --no-feature-limit \\\n", + " --no-tile-size-limit \\\n", + " ~/data/nyc_mappluto_24v1_fgdb/dataMapPLUTO24v1_wgs84.nd.geojson" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "-rw-r--r-- 1 me staff 96M Apr 13 13:52 ./docs/data/new_york_real_estate_MapPLUTO_data_ndjson_min_zoom_0_max_zoom_12_notilesizelimit.pmtiles\n" + ] + } + ], + "source": [ + "!ls -lh ./docs/data/new_york_real_estate_MapPLUTO_data_ndjson_min_zoom_0_max_zoom_12_notilesizelimit.pmtiles" + ] + }, { "cell_type": "code", "execution_count": null,