[GRASS-SVN] r72995 - grass-addons/grass7/imagery/i.sentinel/i.sentinel.download
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Jul 18 16:45:49 PDT 2018
Author: neteler
Date: 2018-07-18 16:45:49 -0700 (Wed, 18 Jul 2018)
New Revision: 72995
Modified:
grass-addons/grass7/imagery/i.sentinel/i.sentinel.download/i.sentinel.download.py
Log:
i.sentinel.download addon: fix for longlat locations
Modified: grass-addons/grass7/imagery/i.sentinel/i.sentinel.download/i.sentinel.download.py
===================================================================
--- grass-addons/grass7/imagery/i.sentinel/i.sentinel.download/i.sentinel.download.py 2018-07-18 11:40:31 UTC (rev 72994)
+++ grass-addons/grass7/imagery/i.sentinel/i.sentinel.download/i.sentinel.download.py 2018-07-18 23:45:49 UTC (rev 72995)
@@ -124,12 +124,22 @@
args = {}
if vector:
args['vector'] = vector
- info = gs.parse_command('g.region', flags='uplg', **args)
- return 'POLYGON(({nw_lon} {nw_lat}, {ne_lon} {ne_lat}, {se_lon} {se_lat}, {sw_lon} {sw_lat}, {nw_lon} {nw_lat}))'.format(
- nw_lat=info['nw_lat'], nw_lon=info['nw_long'], ne_lat=info['ne_lat'], ne_lon=info['ne_long'],
- sw_lat=info['sw_lat'], sw_lon=info['sw_long'], se_lat=info['se_lat'], se_lon=info['se_long']
+ # are we in LatLong location?
+ s = gs.read_command("g.proj", flags='j')
+ kv = gs.parse_key_val(s)
+ if kv['+proj'] != 'longlat':
+ info = gs.parse_command('g.region', flags='uplg', **args)
+ return 'POLYGON(({nw_lon} {nw_lat}, {ne_lon} {ne_lat}, {se_lon} {se_lat}, {sw_lon} {sw_lat}, {nw_lon} {nw_lat}))'.format(
+ nw_lat=info['nw_lat'], nw_lon=info['nw_long'], ne_lat=info['ne_lat'], ne_lon=info['ne_long'],
+ sw_lat=info['sw_lat'], sw_lon=info['sw_long'], se_lat=info['se_lat'], se_lon=info['se_long']
)
+ else:
+ info = gs.parse_command('g.region', flags='upg', **args)
+ return 'POLYGON(({nw_lon} {nw_lat}, {ne_lon} {ne_lat}, {se_lon} {se_lat}, {sw_lon} {sw_lat}, {nw_lon} {nw_lat}))'.format(
+ nw_lat=info['n'], nw_lon=info['w'], ne_lat=info['n'], ne_lon=info['e'],
+ sw_lat=info['s'], sw_lon=info['w'], se_lat=info['s'], se_lon=info['e']
+ )
class SentinelDownloader(object):
def __init__(self, user, password, api_url='https://scihub.copernicus.eu/dhus'):
More information about the grass-commit
mailing list