From: Allin C. <cot...@wf...> - 2020-03-04 02:21:19
|
On Tue, 3 Mar 2020, Ethan A Merritt wrote: > On Tuesday, 3 March 2020 17:05:40 PST Allin Cottrell wrote: >> On Tue, 3 Mar 2020, Ethan A Merritt wrote: >> >>> On Tuesday, 3 March 2020 14:30:40 PST Allin Cottrell wrote: >>>> This question has been posed before (a few years back) but I'm >>>> hoping someone may be able to point me to the state-of-the-art, >>>> if there is such. >>>> >>>> I'd like to be able to produce via gnuplot a map of (for example) >>>> the USA showing the states colored by median income, or PM2.5 >>>> particulate emissions, or whatever. >>>> >>>> I understand that the starting point would be a suitable US states >>>> shapefile (I know where I can get that), which would have to be >>>> translated to a format (resembling world.dat, I suppose) that can be >>>> understood by gnuplot. I have some notion of how that might be done. >>>> >>>> The next issue would be to get gnuplot to colorize specified areas >>>> of the map according to the values of some additional data. >>>> Unfortunately I have little notion of how to do that. >>> >>> The development version of gnuplot supports >>> >>> splot <data> with polygons >> >> Thanks Ethan, and also Dima in this thread. This sounds promising! >> Right now I'm not sure when I'll find time to pursue this in depth, >> but I'm definitely interested and will push it when I can. >> >> Allin Cottrell > > This may be putting the cart before the horse, but... > Do you think it would be helpful to teach gnuplot to read shape files? I'm sure it would be helpful... > I imagine it would be possible to test for the presence of shapelib.so > and provide a binary input mode: > > splot <data> binary filetype=shapelib with polygons > > I have never worked with this libary so I don't know if it is organized > in such a way that this would be possible. but I'm not yet clear on that point myself. I've taken a quick look at shapelib-1.5.0 (which configures and compiles without fuss on my machine) and seen that it can convert both .shp and .dbf files to what look like comprehensible text formats that "ought to be" usable (shp -> polygons that could go into CSV quite easily, and dbf -> descriptions of the elements of the shp file in their order of appearance). But when I said I "had some notion" of how shapelib could help, that wasn't an understatement! Perhaps better to say I "had an inkling" of how it could help. I aim to follow up, but I'll be offline next week so I won't get back to this till the week after. Allin |