Plotting Dams (30 Day Map Challenge Day 1: Points) and a PyTopo Tweak
The 30 Day Map Challenge
started yesterday, and already I'm a day behind. (I'm not going to try
to keep up; I'll be sporadic about challenge entries.) Day 1 was Points.
The website for the challenge has an interesting list of possible data sources, and clicking around them, I found one that looked like a good quickie: a Data is Plural entry that mentioned a dataset from the National Inventory of Dams that lists all dams in the US. That sounds like a useful thing to have.
I downloaded the GPKG file. At first I got a message like "dataset is empty, try again in five minutes for it to regenerate" message, so I waited and indeed, ten minutes later the file downloaded just fine. I was a bit short of time, so I decided rather than writing a new app, I' just take a quick look in PyTopo. PyTopo doesn't read GPKG (yet) so I converted it to GPX:
ogr2ogr -f GPX -t_srs crs:84 all-us-dams.gpx all-us-dams.gpkg
Except that when I ran pytopo all-us-dams.gpx, nothing
happened. I tried running it again with the debug flag (-d); still nothing.
Weird! I started poking through the PyTopo code to add some more debug
messages. But five or ten minutes later, two PyTopo windows popped up!
Seems it just took a really long time to load all the data for every dam
in the US.
But they were blank, and the console showed a math error. It turned out that it helped to add an argument that limited the geography PyTopo intiially displayed, so I used "home" to center it around the point I've defined as home:
pytopo all-us-dams.geojson homeWithout that, PyTopo tries to display too wide an area and ends up getting a math error trying to do its cosines and tangents. I'm working on that now, it'll be fixed by later tonight.
And seeing it, I'm not too surprised it took a while. Just in our little arid local area, there are a ton of dams. I was particularly interested in the thick series of them on the Rio Grande just above Okay Owingeh pueblo, and on tiny Santa Cruz Creek out toward Chimayó.
Meanwhile, of course I had to dive in to making PyTopo show a window
that says "Initializing PyTopo" before it starts to load data,
which of course took way longer than I expected because of issues
with getting GTK to update the window at the right time.
And it still doesn't update it once the data reading has begun;
that will require splitting the data reading off onto a separate thread,
which I definitely don't have time for today. But at least I won't be
stuck wondering "Why isn't it doing anything at all?"
[ 16:24 Nov 02, 2025 More mapping | permalink to this entry | ]