aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xgis-observation-map7
1 files changed, 5 insertions, 2 deletions
diff --git a/gis-observation-map b/gis-observation-map
index 7fa1360..1b6ba44 100755
--- a/gis-observation-map
+++ b/gis-observation-map
@@ -178,6 +178,8 @@ def idx_intersects(idx_path, geometries):
print(f'WARN: {idx_path}: has {ds.GetLayerCount()} != 1 layers', file=sys.stderr)
layer = ds.GetLayer()
+ source_srs = layer.GetSpatialRef()
+ transform_srs = osr.CoordinateTransformation(source_srs, target_srs)
locFieldIdx = layer.FindFieldIndex("location", True)
locations = []
@@ -278,8 +280,8 @@ def geometricFilterPolygon(polygon):
raise Exception('Not a linear ring')
ring2 = []
for i in range(n):
- lat, lon = ring.GetPoint_2D(i)
- ring2.append([lat, lon])
+ lon, lat = ring.GetPoint_2D(i)
+ ring2.append([lon, lat])
polygon2.append(ring2)
return {
@@ -291,6 +293,7 @@ def geometricFilterPolygon(polygon):
def geometricFilter(geometries):
wgs84 = osr.SpatialReference()
wgs84.ImportFromEPSG(4326) # WGS84
+ wgs84.SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER)
towgs84 = osr.CoordinateTransformation(target_srs, wgs84)
myGeometries = []