# Mapping cameras in the city

Rotterdam has a lot of streets with live view cameras. The list of these streets is published in Gemeenteblad for the city and this is an attempt to put this data on a map. The specific locations of cameras aren't published but this is a good start.

[here's where you can find the lists](https://zoek.officielebekendmakingen.nl/resultaten?q=(c.product-area==%22officielepublicaties%22)and(cql.textAndIndexes=%22aanwijzingsbesluit%22%20and%20cql.textAndIndexes=%22cameratoezicht%22)%20AND%20dt.creator==%22Rotterdam%22&zv=aanwijzingsbesluit+cameratoezicht&pg=10&col=&svel=Publicatiedatum&svol=Aflopend&sf=po%7cRotterdam)

![grayscale map with a bunch of red lines](docs/partial-map.png)

this is a WIP, the current structure of repo is as follows:
- `docs/`
  - `add-manually.md` - list of places that are not picked up by scripts and have to be added manually to the map. it's important to update this based on the info you get from `working-data/05`
- `source-data`
  - `all-streets` - what I copied from the OG 2022 gemeenteblad with the camera plan. Doesn't include further changes. Not very useful
  - `by-district/` - the document that describes the camera surveillance divides the city into 11 districts. So there's 11 files in that directory, each containing an annotated list of streets in that district, with further updates from the gemeente. Also includes spelling fixes (surprising amount of misspelled streets in the source documents, but sometimes also the streets are just called differently in OSM. For example Overpass doesn't like "1° Pijnackerstraat" but "1e Pijnackerstraat" works fine. Or the municipality put A. Wellingpad in the document they published but the street is actually called Alberta Wellingpad on OSM.)
  - `query-header` and `query-footer` - don't worry about it too much, this is used by `scripts/03-build-query-for-district` which includes the header and footer in every file it generates. You'll need to play with this if you choose to run these scripts for a different city, because that's where Rotterdam is coded in.
- `scripts/` - the heart of this repo. A set of bash scripts using some basic unix utils and the Overpass API to parse the source data and return jsons that can be converted into geojson. They should be ran in order, starting from `01-sed-to-single-line`, till `05-show-missing-streets`. Each of them will take data from the previous one and output to `working-data/its-own-number` so you can inspect the data at every step of the process.
- `geojson-files/` - QGIS, which I use to assemble the maps accepts data in geojson format. This is where those files should land. Think of it as the output directory of this program. This is not populate by any script. You have to run `for i in working-data/04/*; do osmtogeojson "$i" > "geojson-files/$(basename $i)"; done` from the root dir of this repo to get those files, and `osmtogeojson` is a node.js program that you obtain by running `npm install osmtogeojson`
- `working-data` - this is where each script outputs its data. Ideally you don't need to look into here, except for debugging. one interesting place is `working-data/05` which contains all the places that were requested from the overpass api but didn't return for one reason or another. 
