@@ -87,13 +87,15 @@ def hdx_note(self, theme):
8787
8888 def datasets (self ,is_private ,subnational ,data_update_frequency ,locations ,files ,public_dir ):
8989 HDX_FORMATS = {
90+ 'GeoJSON' :'geojson' ,
9091 'shp' : 'SHP' ,
9192 'geopackage' : 'Geopackage' ,
9293 'garmin_img' : 'Garmin IMG' ,
9394 'kml' : 'KML'
9495 }
9596
9697 HDX_DESCRIPTIONS = {
98+ 'GeoJSON' : 'geojson' ,
9799 'shp' :'ESRI Shapefile' ,
98100 'geopackage' :'Geopackage, SQLite compatible' ,
99101 'garmin_img' :'.IMG for Garmin GPS Devices (All OSM layers for area)' ,
@@ -134,14 +136,24 @@ def datasets(self,is_private,subnational,data_update_frequency,locations,files,p
134136
135137 resources = []
136138 for f in files :
137- if 'theme' not in f .extra or f .extra ['theme' ] == theme .name :
138- file_name = os .path .basename (f .parts [0 ]) # only one part: the zip file
139- resources .append ({
140- 'name' : file_name ,
141- 'format' : HDX_FORMATS [f .output_name ],
142- 'description' : HDX_DESCRIPTIONS [f .output_name ],
143- 'url' : os .path .join (public_dir ,file_name )
144- })
139+ if isinstance (f , dict ): # it is coming from galaxy
140+ if f ['theme' ] == theme .name :
141+ file_name = f ['file_name' ] # only one part: the zip file
142+ resources .append ({
143+ 'name' : file_name ,
144+ 'format' : HDX_FORMATS [f ['output_name' ]],
145+ 'description' : HDX_DESCRIPTIONS [f ['output_name' ]],
146+ 'url' : f ['download_url' ]
147+ })
148+ else :
149+ if 'theme' not in f .extra or f .extra ['theme' ] == theme .name :
150+ file_name = os .path .basename (f .parts [0 ]) # only one part: the zip file
151+ resources .append ({
152+ 'name' : file_name ,
153+ 'format' : HDX_FORMATS [f .output_name ],
154+ 'description' : HDX_DESCRIPTIONS [f .output_name ],
155+ 'url' : os .path .join (public_dir ,file_name )
156+ })
145157 # stable sort, but put shapefiles first for Geopreview to pick up correctly
146158 resources .sort (key = lambda x : 0 if x ['format' ] == 'zipped shapefile' else 1 )
147159 dataset .add_update_resources (resources )
0 commit comments