@@ -87,13 +87,15 @@ def hdx_note(self, theme):
87
87
88
88
def datasets (self ,is_private ,subnational ,data_update_frequency ,locations ,files ,public_dir ):
89
89
HDX_FORMATS = {
90
+ 'GeoJSON' :'geojson' ,
90
91
'shp' : 'SHP' ,
91
92
'geopackage' : 'Geopackage' ,
92
93
'garmin_img' : 'Garmin IMG' ,
93
94
'kml' : 'KML'
94
95
}
95
96
96
97
HDX_DESCRIPTIONS = {
98
+ 'GeoJSON' : 'geojson' ,
97
99
'shp' :'ESRI Shapefile' ,
98
100
'geopackage' :'Geopackage, SQLite compatible' ,
99
101
'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
134
136
135
137
resources = []
136
138
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
+ })
145
157
# stable sort, but put shapefiles first for Geopreview to pick up correctly
146
158
resources .sort (key = lambda x : 0 if x ['format' ] == 'zipped shapefile' else 1 )
147
159
dataset .add_update_resources (resources )
0 commit comments