@@ -119,12 +119,17 @@ def _find_geojson(self):
119119 else :
120120 features_bbox .union (bbox )
121121 if 'x' in attributes .keys () and 'y' in attributes .keys ():
122+ easting , northing = attributes ['x' ], attributes ['y' ]
123+ if int (self .srid ) in (21781 , 2056 ):
124+ logger .debug ("Swap attributes x/y for srid %s" , self .srid )
125+ attributes ['x' ], attributes ['y' ] = attributes ['y' ], attributes ['x' ]
126+ easting , northing = attributes ['x' ], attributes ['y' ]
122127 feature = {
123128 'type' : 'Feature' ,
124129 'id' : item ['id' ],
125130 'bbox' : bbox .bounds ,
126131 'geometry' : {
127- 'type' : 'Point' , 'coordinates' : [attributes [ 'x' ], attributes [ 'y' ] ]
132+ 'type' : 'Point' , 'coordinates' : [easting , northing ]
128133 },
129134 'properties' : attributes
130135 }
@@ -674,6 +679,7 @@ def _box2d_transform(self, res):
674679 raise InternalServerError (msg ) from e
675680
676681 def _parse_locations (self , transformer , res ):
682+ logger .debug ("Parse location result: %s" , res )
677683 if not self .returnGeometry :
678684 attrs2Del = ['x' , 'y' , 'lon' , 'lat' , 'geom_st_box2d' ]
679685 list (map (lambda x : res .pop (x ) if x in res else x , attrs2Del ))
0 commit comments