DataONEorg / dataone-repo-map

R scripts and location data for generating maps of DataONE repositories.
Apache License 2.0
0 stars 1 forks source link

get location from node registry #1

Open mbjones opened 6 years ago

mbjones commented 6 years ago

The DataONE node registry now contains lat/lon pairs for each node, so we can get node information from a query rather than hardcoding the static csv file. Update the Rmd file to get the data that way, as illustrated by this curl command (from @datadavev ):

echo "year,label,description,lon,lat,alt,name,uri" > dataone-nodes.csv
curl -s "https://cn.dataone.org/cn/v2/node" | xml sel -T -t \
 -m "//node[(property/@key='CN_operational_status' and property='operational' or property='replicator') and identifier!='urn:node:CN']" \
 -v "substring(property[@key='CN_date_operational'],1,4)" -o ",\"" \
 -v "property[@key='CN_node_name']" -o "\",\"" \
 -v "normalize-space(description)" -o "\"," \
 -v "property[@key='CN_location_lonlat']" -o ",0," \
 -v identifier -o "," \
 -v "property[@key='CN_logo_url']" -n \
>> dataone-nodes.csv
mbjones commented 6 years ago

Added the above as a shell script dataone-nodes.sh in sha 751196f as a stopgap until we decide to incorporate it into the Rmd file directly.