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

Use ST_PointOnSurface even fo ways in place of ST_Centroid #434

Open
wants to merge 1 commit into
base: bano_v3
Choose a base branch
from
Open
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
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