-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocessData.sh
More file actions
30 lines (26 loc) · 843 Bytes
/
processData.sh
File metadata and controls
30 lines (26 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
INPUT_FILE="${PWD}/osm-data/raw-data.json"
OUTPUT_FILE="${PWD}/osm-data/processed-data.json"
if [ ! -f $INPUT_FILE ]; then
echo -e "File not found at $INPUT_FILE."
echo -e "Did you run fetchData first, and are you in project root?"
exit 1
fi
echo "Processing raw json into geojson format..."
jq -c '
{
"type": "FeatureCollection",
"generator": "overpass-turbo",
"copyright": "The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.",
features:[
.elements[]
| {
type: "Feature",
geometry: {
type: "Point",
coordinates: [(.lon // .center?.lon), (.lat // .center?.lat)]
},
properties: (.tags + {id: (.type + (.id | tostring))})
}
]
}' $INPUT_FILE > $OUTPUT_FILE
echo "Conversion complete, output available at $OUTPUT_FILE"