mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-12 05:44:06 +00:00
trim all coordinate output to 7 digits
This commit is contained in:
@@ -166,7 +166,7 @@ async def get_detailed_place(conn: SearchConnection, place: ntyp.PlaceRef,
|
|||||||
return sql.add_columns(sa.func.ST_AsGeoJSON(
|
return sql.add_columns(sa.func.ST_AsGeoJSON(
|
||||||
sa.case((sa.func.ST_NPoints(column) > 5000,
|
sa.case((sa.func.ST_NPoints(column) > 5000,
|
||||||
sa.func.ST_SimplifyPreserveTopology(column, 0.0001)),
|
sa.func.ST_SimplifyPreserveTopology(column, 0.0001)),
|
||||||
else_=column)).label('geometry_geojson'))
|
else_=column), 7).label('geometry_geojson'))
|
||||||
else:
|
else:
|
||||||
def _add_geometry(sql: SaSelect, column: SaColumn) -> SaSelect:
|
def _add_geometry(sql: SaSelect, column: SaColumn) -> SaSelect:
|
||||||
return sql.add_columns(sa.func.ST_GeometryType(column).label('geometry_type'))
|
return sql.add_columns(sa.func.ST_GeometryType(column).label('geometry_type'))
|
||||||
@@ -210,13 +210,13 @@ async def get_simple_place(conn: SearchConnection, place: ntyp.PlaceRef,
|
|||||||
col = sa.func.ST_SimplifyPreserveTopology(col, details.geometry_simplification)
|
col = sa.func.ST_SimplifyPreserveTopology(col, details.geometry_simplification)
|
||||||
|
|
||||||
if details.geometry_output & ntyp.GeometryFormat.GEOJSON:
|
if details.geometry_output & ntyp.GeometryFormat.GEOJSON:
|
||||||
out.append(sa.func.ST_AsGeoJSON(col).label('geometry_geojson'))
|
out.append(sa.func.ST_AsGeoJSON(col, 7).label('geometry_geojson'))
|
||||||
if details.geometry_output & ntyp.GeometryFormat.TEXT:
|
if details.geometry_output & ntyp.GeometryFormat.TEXT:
|
||||||
out.append(sa.func.ST_AsText(col).label('geometry_text'))
|
out.append(sa.func.ST_AsText(col).label('geometry_text'))
|
||||||
if details.geometry_output & ntyp.GeometryFormat.KML:
|
if details.geometry_output & ntyp.GeometryFormat.KML:
|
||||||
out.append(sa.func.ST_AsKML(col).label('geometry_kml'))
|
out.append(sa.func.ST_AsKML(col, 7).label('geometry_kml'))
|
||||||
if details.geometry_output & ntyp.GeometryFormat.SVG:
|
if details.geometry_output & ntyp.GeometryFormat.SVG:
|
||||||
out.append(sa.func.ST_AsSVG(col).label('geometry_svg'))
|
out.append(sa.func.ST_AsSVG(col, 0, 7).label('geometry_svg'))
|
||||||
|
|
||||||
return sql.add_columns(*out)
|
return sql.add_columns(*out)
|
||||||
|
|
||||||
|
|||||||
@@ -146,13 +146,13 @@ class ReverseGeocoder:
|
|||||||
col = sa.func.ST_SimplifyPreserveTopology(col, self.params.geometry_simplification)
|
col = sa.func.ST_SimplifyPreserveTopology(col, self.params.geometry_simplification)
|
||||||
|
|
||||||
if self.params.geometry_output & GeometryFormat.GEOJSON:
|
if self.params.geometry_output & GeometryFormat.GEOJSON:
|
||||||
out.append(sa.func.ST_AsGeoJSON(col).label('geometry_geojson'))
|
out.append(sa.func.ST_AsGeoJSON(col, 7).label('geometry_geojson'))
|
||||||
if self.params.geometry_output & GeometryFormat.TEXT:
|
if self.params.geometry_output & GeometryFormat.TEXT:
|
||||||
out.append(sa.func.ST_AsText(col).label('geometry_text'))
|
out.append(sa.func.ST_AsText(col).label('geometry_text'))
|
||||||
if self.params.geometry_output & GeometryFormat.KML:
|
if self.params.geometry_output & GeometryFormat.KML:
|
||||||
out.append(sa.func.ST_AsKML(col).label('geometry_kml'))
|
out.append(sa.func.ST_AsKML(col, 7).label('geometry_kml'))
|
||||||
if self.params.geometry_output & GeometryFormat.SVG:
|
if self.params.geometry_output & GeometryFormat.SVG:
|
||||||
out.append(sa.func.ST_AsSVG(col).label('geometry_svg'))
|
out.append(sa.func.ST_AsSVG(col, 0, 7).label('geometry_svg'))
|
||||||
|
|
||||||
return sql.add_columns(*out)
|
return sql.add_columns(*out)
|
||||||
|
|
||||||
|
|||||||
@@ -73,13 +73,13 @@ def _add_geometry_columns(sql: SaLambdaSelect, col: SaColumn, details: SearchDet
|
|||||||
col = sa.func.ST_SimplifyPreserveTopology(col, details.geometry_simplification)
|
col = sa.func.ST_SimplifyPreserveTopology(col, details.geometry_simplification)
|
||||||
|
|
||||||
if details.geometry_output & GeometryFormat.GEOJSON:
|
if details.geometry_output & GeometryFormat.GEOJSON:
|
||||||
out.append(sa.func.ST_AsGeoJSON(col).label('geometry_geojson'))
|
out.append(sa.func.ST_AsGeoJSON(col, 7).label('geometry_geojson'))
|
||||||
if details.geometry_output & GeometryFormat.TEXT:
|
if details.geometry_output & GeometryFormat.TEXT:
|
||||||
out.append(sa.func.ST_AsText(col).label('geometry_text'))
|
out.append(sa.func.ST_AsText(col).label('geometry_text'))
|
||||||
if details.geometry_output & GeometryFormat.KML:
|
if details.geometry_output & GeometryFormat.KML:
|
||||||
out.append(sa.func.ST_AsKML(col).label('geometry_kml'))
|
out.append(sa.func.ST_AsKML(col, 7).label('geometry_kml'))
|
||||||
if details.geometry_output & GeometryFormat.SVG:
|
if details.geometry_output & GeometryFormat.SVG:
|
||||||
out.append(sa.func.ST_AsSVG(col).label('geometry_svg'))
|
out.append(sa.func.ST_AsSVG(col, 0, 7).label('geometry_svg'))
|
||||||
|
|
||||||
return sql.add_columns(*out)
|
return sql.add_columns(*out)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user