Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

Add map output in the report #10

Open
Edouard-Legoupil opened this issue Nov 15, 2017 · 2 comments
Open

Add map output in the report #10

Edouard-Legoupil opened this issue Nov 15, 2017 · 2 comments
Assignees

Comments

@Edouard-Legoupil
Copy link
Member

Edouard-Legoupil commented Nov 15, 2017

Started building some raw map output from data + dictionary:
https://github.com/unhcr/koboloadeR/blob/master/R/kobo_map_cat.R
https://github.com/unhcr/koboloadeR/blob/master/R/kobo_map_int.R

This should be included in the report generation scripts

@Edouard-Legoupil
Copy link
Member Author

Edouard-Legoupil commented Jan 9, 2018

Brainstorming:

The objective is to include basic mapping of the variable

STEP 1 Define 2 additional columns in the xlsform (aka data analysis plan)

to indicate whether the variable should be mapped as:

  • point map (valid if the dataset contains GPS location - geopoint in xlsform)
  • polygon map (referenced through a shapefile)

STEP 2 Add configuration to set up the polygons for the maps.

2 options for the join between the dataset and the polygons:

  • if the dataset contains GPS, then a spatial intersection can be used to join the 2 data frame
  • if the dataset does not contain GPS, then one variable from the dataset (for instance p-code), should be used to build the join. This key should also be available within the shapefile. All variable from the dataset to be summarized and aggregated in relation with this common key

STEP 3 Define default spatial visualization for the map:

Case 1: the variable is numeric

  • if points, 2 paired hexbin maps to have systematically average and sum presented as 2 distinct maps (or one bivariate hexbin). Kernel density map to be also potentially offered...? see example here: https://gist.github.com/geotheory/5748388

image

  • if polygons, sum to be presented as proportional symbol and average value to be used as color scale for the symbols

image

###Case 2: the variable is categoric (aka select_one or select_multiple)

Maps will have to be faceted using as many facet as modalities within the variable.

  • if points, 2 paired hexbin maps should represent frequency of the modality and relative proportion .
  • if polygons, idem, frequency of the modality as proportional symbol and relative proportion encoded as the color scale for the symbol.

##SCRIPT TO WRITE

  1. Automatic parsing of the dataset using the dico to generate spatialpointdataframe
  2. Automatic interserction of the spatialpoint with spatialpolygondataframe
  3. Automatic classification of average/sum or frequency/proportion - probably using ClassInt Jenks algorithm -
  4. Insertion of small histogram in the chart to present the result of the univariate classification
  5. A series of test to ensure that the configuration is ok... (points does intersect polygon, key matching works correctly - cf function: https://github.com/AndySouth/rworldmap/blob/master/R/joinCountryData2Map.R

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant