Updated README and docs

This commit is contained in:
Simon Brooke 2020-01-29 11:45:31 +00:00
parent e06b68bd34
commit b25a71c4b4
3 changed files with 22 additions and 33 deletions

View file

@ -1,6 +1,6 @@
# geocsv # geocsv
GeoCSV is a wee tool to show comma-separated value data on a map. A wee tool to show comma-separated value data on a map.
The CSV file must have The CSV file must have

View file

@ -1,6 +1,6 @@
# geocsv # geocsv
GeoCSV is a wee tool to show comma-separated value data on a map. A wee tool to show comma-separated value data on a map.
The CSV file must have The CSV file must have
@ -12,14 +12,30 @@ The CSV file must have
Additionally, the value of the column `category`, if present, will be used to select map pins from the map pins folder, if a suitable pin is present. Thus is the value of `category` is `foo`, a map pin image with the name `Foo-pin.png` will be selected. Additionally, the value of the column `category`, if present, will be used to select map pins from the map pins folder, if a suitable pin is present. Thus is the value of `category` is `foo`, a map pin image with the name `Foo-pin.png` will be selected.
## Passing CSV files to the app
### Loading them onto the server
If you run the server running **geocsv**, the simplest way to add CSV files is simply to copy them into the directory `resourcs/data`. The default file is the one named `data.csv`, which is the one that will be served if nothing else is specified. Other files can be specifiec by appending `?file=filename` to the URL; so if the URL of your geocsv service is
https://geocsv.example.com/
and the file you want to view is `myfile.csv`, then you would specify this as
https://geocsv.example.com/?file=myfile.csv
### Using a Google spreadsheet
If you use [Google Sheets](https://www.google.co.uk/sheets/about/), then every sheet has a 'document id', a long string of characters which uniquely identifies that sheet. Suppose your Google spreadsheet has a document id of `abcdefghijklmnopqrstuvwxyz-12345`, then you could pull data from this spreadsheet by specifying:
https://geocsv.example.com/?docid=abcdefghijklmnopqrstuvwxyz-12345
The spreadsheet **must** be publicly readable.
## Not yet working ## Not yet working
GeoCSV is at an early stage of development, and some features are not yet working. GeoCSV is at an early stage of development, and some features are not yet working.
### Doesn't actually interpret CSV
I haven't yet found an easy way to parse CSV into EDN client side, so I've written a [separate library](https://github.com/simon-brooke/csv2edn) to do it server side. However, that library is not yet integrated. Currently the client side actually interprets JSON.
### Missing map pin images ### Missing map pin images
At the current stage of development, if no appropriate image exists in the `resources/public/img/map-pins` folder, that's your problem. **TODO:** I intend at some point to make missing pin images default to `unknown-pin.png`, which does exist. At the current stage of development, if no appropriate image exists in the `resources/public/img/map-pins` folder, that's your problem. **TODO:** I intend at some point to make missing pin images default to `unknown-pin.png`, which does exist.
@ -28,26 +44,6 @@ At the current stage of development, if no appropriate image exists in the `reso
Currently the map is initially centred roughly on the centre of Scotland, and scaled arbitrarily. It should compute an appropriate centre and scale from the data provided, but currently doesn't. Currently the map is initially centred roughly on the centre of Scotland, and scaled arbitrarily. It should compute an appropriate centre and scale from the data provided, but currently doesn't.
### There's no way of linking your own data feed
Currently, the data is taken from the file `resources/public/data/data.json`. What I intend is that you should have a form which allows you to either
1. enter [the `DOCID` of your own (publicly readable) Google Sheets spreadsheet](https://stackoverflow.com/questions/33713084/download-link-for-google-spreadsheets-csv-export-with-multiple-sheets);
2. enter the URL of a CSV file publicly available on the web;
3. upload a CSV file to the server.
### There's no way of shareing the map of your own data with other people
Currently, the data that is shared is just the data that's present when the app is compiled. Ideally, there should be a way of generating a URL, which might take the form:
https://server.name/geocsv/docid/564747867
To show data from the first sheet of the Google Sheets spreadsheet whose `DOCID` is 564747867; or
https://server.name/geocsv?uri=https://address.of.another.server/path/to/csv-file.csv
to show the content of a publicly available CSV file.
## Prerequisites ## Prerequisites
You will need [Leiningen][1] 2.0 or above installed. You will need [Leiningen][1] 2.0 or above installed.

View file

@ -70,13 +70,6 @@
:maxZoom 18})) :maxZoom 18}))
view) view)
(dispatch-sync [:set-view view]) (dispatch-sync [:set-view view])
;; (.on view "moveend"
;; (fn [_] (let [c (.getCenter view)]
;; (js/console.log (str "Moving centre to " c))
;; (dispatch-sync [:set-latitude (.-lat c)])
;; (dispatch-sync [:set-longitude (.-lng c)])
;; (dispatch [:fetch-data]))))
;; (refresh-map-pins)
view)) view))
(defn map-did-mount (defn map-did-mount