Skip to content

Commit

Permalink
Use ST_PointOnSurface even fo ways in place of ST_Centroid
Browse files Browse the repository at this point in the history
  • Loading branch information
frodrigo committed Feb 5, 2025
1 parent de37ff0 commit 57b6cc4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions bano/sql/charge_numeros_OSM.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ FROM
UNION ALL
-- way avec addr:street ou addr:place
SELECT 2,
ST_Centroid(w.way),
ST_PointOnSurface(w.way),
w."addr:housenumber",
w."addr:street",
w."addr:place",
Expand Down Expand Up @@ -55,7 +55,7 @@ FROM
UNION ALL
-- way dans relation associatedStreet
SELECT 4,
ST_Centroid(w.way),
ST_PointOnSurface(w.way),
w."addr:housenumber",
null,
null,
Expand All @@ -70,7 +70,7 @@ FROM
UNION ALL
-- relation multipoly dans relation associatedStreet
SELECT 4,
ST_Centroid(w.way),
ST_PointOnSurface(w.way),
w."addr:housenumber",
null,
null,
Expand Down
2 changes: 1 addition & 1 deletion bano/sql/charge_numeros_bbox_OSM.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ FROM
UNION
-- way dans relation associatedStreet
SELECT 6,
ST_Centroid(w.way),
ST_PointOnSurface(w.way),
w."addr:housenumber",
null,
r.tags,
Expand Down
4 changes: 2 additions & 2 deletions bano/sql/charge_points_nommes_centroides_OSM.sql
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ WHERE rang = 1
GROUP BY 2,3,4,5,6,7),
centroide_lignes_agregees
AS
(SELECT ST_Centroid(ST_LineMerge(ST_Collect(way_line))) way,
(SELECT ST_PointOnSurface(ST_LineMerge(ST_Collect(way_line))) way,
name,
name_tag,
insee_ac,
Expand Down Expand Up @@ -131,7 +131,7 @@ FROM (SELECT pl.way point,
pl.highway NOT IN ('bus_stop','platform') AND
pl.name != ''
UNION
SELECT ST_Centroid(pl.way),
SELECT ST_PointOnSurface(pl.way),
pl.name,
pl."ref:FR:FANTOIR" f
FROM (SELECT way FROM planet_osm_polygon WHERE "ref:INSEE" = '__code_insee__') p
Expand Down
2 changes: 1 addition & 1 deletion bano/sql/charge_points_nommes_places_OSM.sql
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ UNNEST(
),
polys
AS
(SELECT st_centroid(pt.way) AS way,
(SELECT ST_PointOnSurface(pt.way) AS way,
name_osm.name,
name_osm.name_tag,
tags,
Expand Down
4 changes: 2 additions & 2 deletions bano/sql/create_table_base_bano_sources.sql
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ CREATE TABLE IF NOT EXISTS lieux_dits (
created date,
updated date,
geometrie geometry(Polygon,4326),
geom_centroid geometry (Point, 4326) GENERATED ALWAYS AS (ST_Centroid(geometrie)) STORED);
geom_centroid geometry (Point, 4326) GENERATED ALWAYS AS (ST_PointOnSurface(geometrie)) STORED);

CREATE INDEX IF NOT EXISTS gidx_lieux_dits ON lieux_dits USING gist(geometrie);
CREATE INDEX IF NOT EXISTS gidx__centroid_lieux_dits ON lieux_dits USING gist(geom_centroid);
Expand All @@ -66,7 +66,7 @@ CREATE TABLE IF NOT EXISTS cadastre_communes (
created date,
updated date,
geometrie geometry(MultiPolygon,4326),
geom_centroid geometry (Point, 4326) GENERATED ALWAYS AS (ST_Centroid(geometrie)) STORED,
geom_centroid geometry (Point, 4326) GENERATED ALWAYS AS (ST_PointOnSurface(geometrie)) STORED,
geom_3857 geometry (MultiPolygon, 3857) GENERATED ALWAYS AS (ST_Transform(geometrie,3857)) STORED);

CREATE INDEX IF NOT EXISTS gidx_cadastre_communes ON cadastre_communes USING gist(geometrie);
Expand Down

0 comments on commit 57b6cc4

Please sign in to comment.