Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update docs for kind=address in buildings layer. #104

Merged
merged 2 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions basemaps/layers.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,16 @@ The current version is **Version 4**.

<MaplibreMap highlightLayer="buildings" :zoom=14 :showZoom="true" :lat="51.5" :lng="-0.2"/>

Buildings from OpenStreetMap. z0-14 contains merged buildings, even disconnected ones. z15+ contains individual OSM equivalent buildings.

| Key | Values | Description |
| ------------ | :-------------------------: | ------------------------------------------: |
| `kind` | `building`, `building_part` | Whether it is a whole building or one part. |
| `height` | number | May be quantized at low zoom levels. |
| `min_height` | number | May be quantized at low zoom levels. |
| `layer` | integer | Layer position relative to other buildings. |
Buildings and address points from OpenStreetMap. z0-14 contains merged buildings, even disconnected ones. z15+ contains individual OSM equivalent buildings.

| Key | Values | Description |
| ------------------ | :--------------------------------------: | -----------------------------------------------------------: |
| `kind` | `address`, `building`, `building_part` | Whether it is an address point, whole building or one part. |
| `addr_housenumber` | string | Address number for `kind=address`. |
| `height` | number | May be quantized at low zoom levels. |
| `min_height` | number | May be quantized at low zoom levels. |
| `layer` | integer | Layer position relative to other buildings. |


## earth

Expand Down
17 changes: 15 additions & 2 deletions components/MaplibreMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ var map;
const lang = ref("en");
const currentZoom = ref(0);

const tableFromFeatures = (features: unknown[]) => {
let tableHTML = "<div>";

features.forEach((f) => {
tableHTML += tableFromProps(f.properties);
});

tableHTML += "</div>";
return tableHTML;
};

const tableFromProps = (props: unknown) => {
let tableHTML = "<table>";

Expand Down Expand Up @@ -140,8 +151,10 @@ onMounted(() => {
["highlight_circle", "highlight_stroke", "highlight_fill"],
(e) => {
map.getCanvas().style.cursor = "pointer";
const properties = e.features[0].properties;
popup.setLngLat(e.lngLat).setHTML(tableFromProps(properties)).addTo(map);
popup
.setLngLat(e.lngLat)
.setHTML(tableFromFeatures(e.features))
.addTo(map);
},
);

Expand Down