Skip to content

Commit

Permalink
Compute bbox on global projection to avoid miscomputation osm-fr#1493
Browse files Browse the repository at this point in the history
  • Loading branch information
frodrigo committed Dec 23, 2023
1 parent 87177eb commit d4c5bb0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions analysers/Analyser_Merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ def insertOfficial(res):
osmosis.run0((sql01_ref if conflate.osmRef != "NULL" else sql01_geo).format(table = table, geom = self.geom, validationGeomSQL = self.validationGeomSQL, where = Select.where_attributes(self.select), distinct = distinct, order_by = order_by), insertOfficial)
osmosis.run(sql02b.format(official = tableOfficial))
if self.parser.imported_srid():
giscurs.execute("SELECT ST_AsText(ST_Envelope(ST_Extent(geom))) FROM {0}".format(tableOfficial))
giscurs.execute("SELECT ST_AsText(ST_Envelope(ST_SetSRID(ST_Extent(ST_Transform(geom, 4326)), 4326))) FROM {0}".format(tableOfficial, self.proj))
self.bbox = giscurs.fetchone()[0]
else:
self.bbox = None
Expand Down Expand Up @@ -1273,7 +1273,7 @@ def analyser_osmosis_common(self):
LEFT JOIN LATERAL (SELECT DISTINCT ref FROM regexp_split_to_table(tags->'{ref}', ';') AS a(ref)) a(ref) ON true
WHERE""" + ("""
{geomSelect} IS NOT NULL AND""" if self.parser.imported_srid() else "") + ("""
ST_Transform(ST_Expand(ST_SetSRID(ST_GeomFromText('{bbox}'), {proj}), {distance}), 4326) && {geomSelect} AND""" if self.load.bbox and self.parser.imported_srid() else "") + """
ST_Transform(ST_Expand(ST_Transform(ST_SetSRID(ST_GeomFromText('{bbox}'), 4326), {proj}), {distance}), 4326) && {geomSelect} AND""" if self.load.bbox and self.parser.imported_srid() else "") + """
tags != ''::hstore AND
{where})""").format(
type = type[0].upper(),
Expand Down

0 comments on commit d4c5bb0

Please sign in to comment.