Instead of looking for the primary download link for spatial data, just add a labelled entry to the downloadUrl reference for every downloadable resource.
|
# Look for the primary download link |
|
resources = @dataset['resources'] || [] |
|
spatial_formats = %w[GeoTIFF Shapefile GeoJSON KML KMZ GML GPX] |
|
spatial_resource = resources.find { |r| spatial_formats.include?(r['format']) } || resources.first |
|
|
|
if spatial_resource && spatial_resource['download_url'].present? |
|
refs['http://schema.org/downloadUrl'] = [ |
|
{url: spatial_resource['download_url'], label: spatial_resource['format']} |
|
] |
|
end |
Instead of looking for the primary download link for spatial data, just add a labelled entry to the downloadUrl reference for every downloadable resource.
org.humdata/mapper.rb
Lines 213 to 222 in cb6080a