Skip to content

Commit

Permalink
fix a bug on determining srid when upload a vector layer
Browse files Browse the repository at this point in the history
  • Loading branch information
boney-bun committed Jun 21, 2018
1 parent 0ea02f2 commit df3faf2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions geonode/layers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,9 @@ def get_bbox(filename):
datasource = DataSource(filename)
layer = datasource[0]
bbox_x0, bbox_y0, bbox_x1, bbox_y1 = layer.extent.tuple
srid = layer.srs.srid if layer.srs else 'EPSG:4326'
# eliminate default EPSG srid as it will be added when this function returned
srid = layer.srs.srid \
if layer.srs and layer.srs.srid is not None else '4326'
elif is_raster(filename):
gtif = gdal.Open(filename)
gt = gtif.GetGeoTransform()
Expand Down Expand Up @@ -375,7 +377,8 @@ def get_bbox(filename):
bbox_y0 = min(ext[0][1], ext[2][1])
bbox_x1 = max(ext[0][0], ext[2][0])
bbox_y1 = max(ext[0][1], ext[2][1])
srid = srs.GetAuthorityCode(None) if srs else 'EPSG:4326'
# eliminate default EPSG srid as it will be added when this function returned
srid = srs.GetAuthorityCode(None) if srs else '4326'

return [bbox_x0, bbox_x1, bbox_y0, bbox_y1, "EPSG:%s" % str(srid)]

Expand Down

0 comments on commit df3faf2

Please sign in to comment.