diff --git "a/docs/emoji-test-\360\237\224\213.md" "b/docs/emoji-test-\360\237\224\213.md" new file mode 100644 index 0000000..a341e84 --- /dev/null +++ "b/docs/emoji-test-\360\237\224\213.md" @@ -0,0 +1,170 @@ +--- +toc: false +--- + + + +
NYC Planning Primary Land Use Tax Lot Output Data Dictionary
Code for data transform, starting from downloading the data from the New York City Department of City Planning
+
+```js
+const center = [40.7,-74];
+const zoom = 13.5;
+```
+
+```js
+const areas = FileAttachment("data/new_york_real_estate_MapPLUTO_data_min_zoom_0_max_zoom_g.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: 1000px;";
+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] + '