Skip to content

Commit 9267e3c

Browse files
authored
Merge pull request #68 from JakobMiksch/2025-05-17-minor-changes
2025 05 17 minor changes
2 parents 42e8ae0 + 22b9538 commit 9267e3c

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

data/query_function.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ OR REPLACE FUNCTION postgisftw.osm_website_objects_around (
6363
osm_id,
6464
tags,
6565
REPLACE(ST_GeometryType(geog::geometry), 'ST_', '') as geometry_type,
66+
-- only return geometry if it is in viewport
6667
CASE
6768
WHEN NOT ST_Covers (
6869
ST_MakeEnvelope (min_lon, min_lat, max_lon, max_lat, 4326)::geography,
@@ -96,6 +97,7 @@ OR REPLACE FUNCTION postgisftw.osm_website_objects_enclosing_small (
9697
osm_id,
9798
tags,
9899
REPLACE(ST_GeometryType(geog::geometry), 'ST_', '') as geometry_type,
100+
-- only return geometry if it is in viewport
99101
CASE
100102
WHEN NOT ST_Covers (
101103
ST_MakeEnvelope (min_lon, min_lat, max_lon, max_lat, 4326)::geography,
@@ -135,6 +137,7 @@ OR REPLACE FUNCTION postgisftw.osm_website_objects_enclosing_large (
135137
ELSE NULL
136138
END as tags,
137139
REPLACE(ST_GeometryType(geom), 'ST_', '') as geometry_type,
140+
-- only return geometry if it is in viewport
138141
CASE
139142
WHEN NOT ST_Covers (
140143
ST_MakeEnvelope (min_lon, min_lat, max_lon, max_lat, 4326)::geography,

postgres/docker-entrypoint-initdb.d/01_create_postgis.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ CREATE TABLE
77
polygons_subdivided (
88
osm_id int NOT NULL,
99
osm_type char NOT NULL,
10-
geom geometry NOT NULL
10+
geom Geometry(POLYGON, 4326) NOT NULL
1111
);
1212

1313
CREATE INDEX idx_polygons_subdivided_geom ON polygons_subdivided USING gist (geom);

web-client/src/components/OsmInfo.vue

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
</h4>
88
<table>
99
<tbody>
10-
<tr v-for="(value, key) in tags" :key="key">
11-
<td :style="{fontWeight: 'bold'}">{{ key }}</td>
12-
<td>{{ value }}</td>
10+
<tr v-for="([key, value]) in Object.entries(tags).slice(0, countShownTags)">
11+
<td :style="{fontWeight: 'bold'}">{{ key }}</td>
12+
<td>{{ value }}</td>
1313
</tr>
14+
<tr v-if="Object.keys(tags).length > countShownTags">{{ Object.keys(tags).length - countShownTags }} more tags</tr>
1415
</tbody>
1516
</table>
1617
</p>
@@ -19,10 +20,20 @@
1920
<script setup lang="ts">
2021
import { computed } from 'vue';
2122
22-
const props = defineProps<{
23-
results: any;
24-
headline: string;
25-
}>();
23+
const props = defineProps({
24+
results: {
25+
type: Array as () => any[],
26+
required: true
27+
},
28+
headline: {
29+
type: String,
30+
required: true
31+
},
32+
countShownTags: {
33+
type: Number,
34+
default: 5
35+
}
36+
});
2637
2738
const hasResults = computed(() => !!props.results.length);
2839
</script>

0 commit comments

Comments
 (0)