Skip to content

Commit

Permalink
Fix crs for layers with CRS in G3W_PROJ4_EPSG setting (#657)
Browse files Browse the repository at this point in the history
Co-authored-by: wlorenzetti <[email protected]>
  • Loading branch information
wlorenzetti and wlorenzetti authored Nov 16, 2023
1 parent 790cd68 commit 481f07d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions g3w-admin/qdjango/api/projects/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -853,16 +853,22 @@ def to_representation(self, instance):

# Patch for Proj4 > 4.9.3 version
if ret["crs"] in settings.G3W_PROJ4_EPSG.keys():
proj4 = settings.G3W_PROJ4_EPSG[ret["crs"]]
proj4 = settings.G3W_PROJ4_EPSG[ret["crs"]]['proj4']
extent = settings.G3W_PROJ4_EPSG[ret["crs"]]['extent']

else:
proj4 = crs.toProj4()
if crs.postgisSrid() in (4326, 3857):
extent = get_crs_bbox(crs)
else:
extent = [0, 0, 8388608, 8388608]

ret['crs'] = {
'epsg': crs.postgisSrid(),
'proj4': proj4,
'geographic': crs.isGeographic(),
'axisinverted': crs.hasAxisInverted(),
'extent': get_crs_bbox(crs)
'extent': extent
}

# add metadata
Expand Down

0 comments on commit 481f07d

Please sign in to comment.