Skip to content
Permalink
Browse files
MetaSearch: set 4326 as default CRS, use WKT to feed polygon geometry
  • Loading branch information
tomkralidis committed Apr 3, 2017
1 parent e462bfb commit d6433c5b4c08349ae07147e8309ab07e24966664
Showing with 6 additions and 8 deletions.
  1. +6 −8 python/plugins/MetaSearch/dialogs/maindialog.py
@@ -392,7 +392,10 @@ def set_bbox_from_map(self):
"""set bounding box from map extent"""

crs = self.map.mapSettings().destinationCrs()
crsid = int(crs.authid().split(':')[1])
try:
crsid = int(crs.authid().split(':')[1])
except IndexError: # no projection
crsid = 4326

extent = self.map.extent()

@@ -570,7 +573,7 @@ def record_clicked(self):
if points is not None:
src = QgsCoordinateReferenceSystem(4326)
dst = self.map.mapSettings().destinationCrs()
geom = QgsGeometry.fromPolygon(points)
geom = QgsGeometry.fromWkt(points)
if src.postgisSrid() != dst.postgisSrid():
ctr = QgsCoordinateTransform(src, dst)
try:
@@ -953,11 +956,6 @@ def bbox_to_polygon(bbox):
maxx = float(bbox.maxx)
maxy = float(bbox.maxy)

return [[
QgsPoint(minx, miny),
QgsPoint(minx, maxy),
QgsPoint(maxx, maxy),
QgsPoint(maxx, miny)
]]
return 'POLYGON((%.2f %.2f, %.2f %.2f, %.2f %.2f, %.2f %.2f, %.2f %.2f))' % (minx, miny, minx, maxy, maxx, maxy, maxx, miny, minx, miny) # noqa
else:
return None

0 comments on commit d6433c5

Please sign in to comment.