Factor out plot adding and fix issues

Opening this PR ASAP due to https://github.com/OpenTreeMap/OTM2/issues/1717, but it needs more documentation, testing, and integration with other bugfixes.
IIRC, django, jquery and javascript have special rules for casting back and forth between strings and integers for representing ids. Seems like we want:
```javascript
var isPrimaryKey = R.or(_.isNumeric, R.and( _.isString, fn));
```
where `fn` is the regexp boolean matcher bool for [0-9]+