Fixed CR suggestions

This commit is contained in:
Antonio
2018-03-16 16:33:45 +01:00
17 changed files with 3670 additions and 392 deletions

View File

@@ -99,10 +99,6 @@ RETURNS Geometry AS $$
try:
service_manager.assert_within_limits()
if not searchtext and not city and not state_province and not country:
service_manager.quota_service.increment_empty_service_use()
return None
geocoder = HereMapsGeocoder(service_manager.config.heremaps_app_id, service_manager.config.heremaps_app_code, service_manager.logger, service_manager.config.heremaps_service_params)
coordinates = geocoder.geocode(searchtext=searchtext, city=city, state=state_province, country=country)
if coordinates:
@@ -136,10 +132,6 @@ RETURNS Geometry AS $$
try:
service_manager.assert_within_limits(quota=False)
if not searchtext and not city and not state_province and not country:
service_manager.quota_service.increment_empty_service_use()
return None
geocoder = GoogleMapsGeocoder(service_manager.config.google_client_id, service_manager.config.google_api_key, service_manager.logger)
coordinates = geocoder.geocode(searchtext=searchtext, city=city, state=state_province, country=country)
if coordinates:
@@ -177,10 +169,6 @@ RETURNS Geometry AS $$
try:
service_manager.assert_within_limits()
if not searchtext and not city and not state_province and not country:
service_manager.quota_service.increment_empty_service_use()
return None
geocoder = MapzenGeocoder(service_manager.config.mapzen_api_key, service_manager.logger, service_manager.config.service_params)
country_iso3 = None
if country:
@@ -224,10 +212,6 @@ RETURNS Geometry AS $$
try:
service_manager.assert_within_limits()
if not searchtext and not city and not state_province and not country:
service_manager.quota_service.increment_empty_service_use()
return None
geocoder = MapboxGeocoder(service_manager.config.mapbox_api_key, service_manager.logger, service_manager.config.service_params)
country_iso3166 = None

View File

@@ -169,7 +169,7 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$
# -- TODO encapsulate this block into a func/method
locations = isolines[r] + [ isolines[r][0] ] # close the polygon repeating the first point
wkt_coordinates = ','.join(["%f %f" % (l.longitude, l.latitude) for l in locations])
sql = "SELECT ST_MPolyFromText('MULTIPOLYGON((({0})))', 4326) as geom".format(wkt_coordinates)
sql = "SELECT ST_CollectionExtract(ST_MakeValid(ST_MPolyFromText('MULTIPOLYGON((({0})))', 4326)),3) as geom".format(wkt_coordinates)
multipolygon = plpy.execute(sql, 1)[0]['geom']
else:
multipolygon = None