Skip to content

Commit

Permalink
Proxy support bugfix and zoom scale adjust
Browse files Browse the repository at this point in the history
This commit contains the following items:

 * fixed geocoder constructor call in function get_geocoder_instance; now proxy
   information is correctly passed to the constructor;
 * added scale_factor constant to correctly reflect the zoom scale set in
   settings dialog; this constant is used in function process_point.
  • Loading branch information
davtorgh committed Sep 2, 2016
1 parent 8ffa674 commit 55d155c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions GeoCoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
from PlaceSelectionDialog import PlaceSelectionDialog
from Utils import *

# constant to adjust the input scale parameter to display correct scale in qgis
SCALE_FACTOR = 0.1082251082

class GeoCoding:

Expand Down Expand Up @@ -288,9 +290,9 @@ def get_geocoder_instance(self):
else:
proxyConnection = {}

geocoder = getattr(self.geocoders, geocoder_class, proxyConnection)

return geocoder()
# init geocoder instance with proxy
geocoder = getattr(self.geocoders, geocoder_class)
return geocoder(proxies=proxyConnection)


def process_point(self, place, point):
Expand All @@ -303,7 +305,10 @@ def process_point(self, place, point):
x = point[0]
y = point[1]
# stupid qvariant return a tuple
scale = float(self.get_config('ZoomScale', 0))

# adjust scale to display correct scale in qgis
scale = float(self.get_config('ZoomScale', 0)) * SCALE_FACTOR

if not scale:
scale = float(self.canvas.scale())

Expand Down

0 comments on commit 55d155c

Please sign in to comment.