Adding map pins for an indicator - Vanuatu-National-Statistics-Office/vnso-nsdp-platform GitHub Wiki
Adding map pins to an indicator requires two files:
-
A CSV file containing the latitude, longitude, and any other data for each pin. Each pin is a row in the file. Here is an example:
longitude,latitude,Total enrollment 168.123286,-16.136503,59 168.16987,-16.111063,46
-
A YAML file in the
map-points
folder. These need to be named according to the indicator that they apply to. For example, if the map pins are for a standalone indicator calledschool-attendance
, then the file needs to be calledschool-attendance.yml
. Here is an example:map_points: - input: geojson/points/schools.csv output: school-attendance-locations.geojson label: Schools
Some notes about the parameters in the map_points
configuration above:
input
: This must be the path to the CSV file described above.output
: This is an arbitrary file name of the geojson file that will be generated.label
: This determines the label of the button on the map to view the pins.
Here is a step-by-step guide to adding pins to an indicator. All of the filenames and labels are examples. We will assume the indicator is called "my-indicator".
-
Create a CSV file containing columns for
latitude
,longitude
, and at least one other column (eg "Name"). Give it at least one row, with real lat/long coordinates and some text in the other column. For example:longitude,latitude,Name 168.123286,-16.136503,Location 1 168.16987,-16.111063,Location 2
-
Name the CSV file
my-point-data.csv
and upload it to the repository in the "geojson/points" folder. -
Create a new file called
my-indicator.yml
and give it the following content:map_points: - input: geojson/points/my-point-data.csv output: my-indicator-pins.geojson label: Pins for my indicator
-
Upload it to the "map-points" folder.