Flow-Based-Cartograms/go_cart

.get and .dat files

Closed this issue · 3 comments

sorry im not too familiar with geospatial data formats- do you have a spec for these two formats? its not totally obvious what the lines in the files represent. otherwise, the repo is great!

it looks like gen files describe a polygon and give it a number, and dat files say the data point that corresponds to that number

Dear Patrick,

You're right that the

  • .gen file contains the sets of polygons (e.g. states in the US, possibly with off-shore islands) that make up the map and
  • the .dat file lists the target areas of the regions.

You're right that we should copy the description of the file format to the readme. It's currently hidden as a comment at the top of main.c. I copy it below.

If you have your input in a .shp file, I can send you an R script that converts to a .gen file. It still would need some manual checks whether (a) the file format is correct, (b) whether the topology is valid (e.g. no overlapping polygons). This process is unfortunately quite difficult to automate completely.

Please let me know whether I've addressed your question.

Best wishes,
Michael

/* The input coordinates in the first command-line argument must be in       */
/* ArcInfo "generate" format of the type:                                    */

/* 2302 Maine02              ID for region followed by optional description. */
/* 0.302204 -0.188090        Pairs of x-, y-coordinates. Orientation along   */
/* 0.302716 -0.187835        outer boundaries must be clockwise. If a        */
/* ...                       polygon has a hole, the inner boundary must be  */
/* 0.303897 -0.193159        anticlockwise.                                  */
/* 0.302204 -0.188090        Regions are not permitted to overlap. This is   */
/* END                       *not* checked by this code!                     */
/* 2301 Maine01                                                              */
/* 0.333358 -0.200693                                                        */
/* ...                                                                       */
/* 0.333358 -0.200693                                                        */
/* END                                                                       */
/* 2301 Maine01              IDs can repeat if a region consists of          */
/* 0.334699 -0.204771        multiple polygons.                              */
/* ...                                                                       */
/* 0.334699 -0.204771                                                        */
/* END                       Each polygon terminates with END.               */
/* END                       One more END signals the end of the file.       */

/* The target area in the second command-line argument must be given in the  */
/* space-delimited format                                                    */
/* region_ID target_area (optional comment)                                  */
/* For example,                                                              */

/* 1 9.0 Alabama                                                             */
/* 4 11.0 Arizona                                                            */
/* 5 6.0 Arkansas                                                            */
/* ...                                                                       */

Closing this issue.