Skip to content

Visualise data on a map by distorting the regions to make their areas proportional to the data values

License

Notifications You must be signed in to change notification settings

razimantv/map-distort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

map-distort

Visualise data on a map by distorting the regions to make their areas proportional to the data values

Example Sample

Sample data

Some example data for India is given, including only the states and Delhi. Jammu & Kashmir is taken as the pre-bifurcation state.

Usage

First, build the program using

g++-11 -O3 -W -Wall -Wno-unused-result -std=c++2a    weighted_distort.cpp   -o weighted_distort

You would need a modern C++ compiler.

To modify a map you can then use

echo input.map data_input.dat num_rounds | ./weighted_distort > map_output.dat
  • input.map is the input map with one region per line. Unfortunately, the program only works with regions that are pseudo-svg paths - that is, piecewise linear paths consisting of only "m, h, v, l, z" elements and commas between coordinates replaced by spaces. See states_boundary.map for an example.
  • data_input.dat contains the data of the weight, one line per region. Regions with zero weight are ignored
  • num_rounds is the number of rounds to run the region relaxation for. I usually take around 10K rounds, and it stops earlier if every state is resized to 1% accuracy
  • map_output.dat is the output file which can be easily processed by gnuplot, with x y region_id per line and a blank line between two subregions

Sample images can be generated by running

bash process.sh

This step requires gnuplot and imagemagick (convert) to be callable directly.

Credits

About

Visualise data on a map by distorting the regions to make their areas proportional to the data values

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published