News:

Thank you for your patience during the Forum downtime while we upgraded the software. Welcome back and see this thread for some new features and other changes to the forum.

Main Menu

Mississippi county collecting

Started by hbelkins, February 02, 2017, 04:30:30 PM

Previous topic - Next topic

hbelkins

Here's your assignment, should you choose to accept it.

Plot the shortest, best and most direct route to pick up all the counties in white that lie north of I-20, beginning in the north and ending in Jackson.



(Crossposted to the Road Trips board...)


Government would be tolerable if not for politicians and bureaucrats.


Jim

Sounds like a great motivation to combine Travel Mapping data with county information (is there an free/easy/automated way to query the county for a given lat,lng point?).  If I could do that, this could be a fun task for me or my Algorithms students...
Photos I post are my own unless otherwise noted.
Signs: https://www.teresco.org/pics/signs/
Travel Mapping: https://travelmapping.net/user/?u=terescoj
Counties: http://www.mob-rule.com/user/terescoj
Twitter @JimTeresco (roads, travel, skiing, weather, sports)

yakra

Quote from: Jim on February 02, 2017, 04:54:58 PM
Sounds like a great motivation to combine Travel Mapping data with county information (is there an free/easy/automated way to query the county for a given lat,lng point?).  If I could do that, this could be a fun task for me or my Algorithms students...

Mississippi GIS Data Download / County Boundaries

You can use QGIS to re-save the GIS data layer in your choice of coordinate reference systems. I just re-saved the county boundaries layer in NAD83(CSRS98), which I believe is the same CRS that the Canadian GeoBase files use.
I haven't checked (IE, loaded the SHP file into a hex editor) to be sure, but odds are good that the resulting file will have its data saved in 64-bit floating point, lng/lat format. Which of course should Play Nice with TravelMapping data.
From there, writing a quick-n-dirty program to dump the polygons to individual files (in whatever format you need -- even, say, WPT) should be relatively easy.

So yeah. That's your county data in lat,lng format at least. As far as a way to query the county for a given point, I'll leave that as an exercise for you and/or your students. :)
"Officer, I'm always careful to drive the speed limit no matter where I am and that's what I was doin'." Said "No, you weren't," she said, "Yes, I was." He said, "Madam, I just clocked you at 22 MPH," and she said "That's the speed limit," he said "No ma'am, that's the route numbah!"  - Gary Crocker

yakra

#3
I now have WPT files for each of 82 counties. 8-)

Quote from: SHP file format specA polygon consists of a number of rings.  A ring is a closed,
non-self-intersecting loop.  The order of vertices or orientation for a ring
indicates which side of the ring is within the polygon.  The neighborhood to
the right of an observer walking along the ring in vertex order is the
neighborhood inside the polygon.  Vertices for a single, ringed polygon are,
therefore, always in clockwise order.

As far as querying a county goes, how about this...?
Search for the nearest vertex or edge to the lat,lng point. (The QuadTree can help with this, yes?)
Each edge can store 1 or two associated polygons, just as a TMG file stores an edge's associated routes. (In an HDX style view, county lines would be green, and the state line blue.)
The vertex order would determine whether the lat,lng point is in the polygon on one side, the polygon on the other, or not within any polygons / outside Mississippi.
"Officer, I'm always careful to drive the speed limit no matter where I am and that's what I was doin'." Said "No, you weren't," she said, "Yes, I was." He said, "Madam, I just clocked you at 22 MPH," and she said "That's the speed limit," he said "No ma'am, that's the route numbah!"  - Gary Crocker

Jim

I am teaching Algorithms in the spring, so this could happen...
Photos I post are my own unless otherwise noted.
Signs: https://www.teresco.org/pics/signs/
Travel Mapping: https://travelmapping.net/user/?u=terescoj
Counties: http://www.mob-rule.com/user/terescoj
Twitter @JimTeresco (roads, travel, skiing, weather, sports)

yakra

I can upload the WPTs to GitHub or email them if you'd like. They're 908k zipped up.

:coffee: Scattered thoughts:
- We'd need to pay more attention to edges than vertices, which gets... more involved. I won't get further into that, because brevity. :)
- Not aware of any such instances in MS, but there's the case of holes in polygons, E.G. a county entirely surrounding another county or group of counties. WPT, only intended to represent polylines, won't support this, but SHP does. A more detailed...
Quote from: a more recent revision of the shapefile specA polygon consists of one or more rings.  A ring is a connected sequence of four or more
points that form a closed, non-self-intersecting loop.  A polygon may contain multiple
outer rings.  The order of vertices or orientation for a ring indicates which side of the ring
is the interior of the polygon.  The neighborhood to the right of an observer walking along
the ring in vertex order is the neighborhood inside the polygon.  Vertices of rings defining
holes in polygons are in a counterclockwise direction.  Vertices for a single, ringed
polygon are, therefore, always in clockwise order.  The rings of a polygon are referred to
as its parts.
A possible workaround: check whether all a county's polylines are themselves within another given polygon.
If doing this in, say, Virginia, allowing holes in polygons would be more necessary: Independent cities.

Do I see another HDX file type on the horizon, for multi-part polygons? 8-)
"Officer, I'm always careful to drive the speed limit no matter where I am and that's what I was doin'." Said "No, you weren't," she said, "Yes, I was." He said, "Madam, I just clocked you at 22 MPH," and she said "That's the speed limit," he said "No ma'am, that's the route numbah!"  - Gary Crocker

yakra

Jim, I've copied our discussion to the TM forum, so as not to spam up HB's post here on AARoads with a bunch of not-too-relevant stuff.
"Officer, I'm always careful to drive the speed limit no matter where I am and that's what I was doin'." Said "No, you weren't," she said, "Yes, I was." He said, "Madam, I just clocked you at 22 MPH," and she said "That's the speed limit," he said "No ma'am, that's the route numbah!"  - Gary Crocker

codyg1985

Calhoun County, MS is the hardest of all of those to get. How long of a period would you be around trying to get those counties?
Cody Goodman
Huntsville, AL, United States

hbelkins

Not that this has much relevance to me anymore. I was planning to attend last spring's meet in Jackson, Miss., but my health problems a few weeks prior not only sapped my stamina and energy to make such a long trip, but all my leave days from work that would have allowed me to travel. At this point I'm not sure when I will be able to travel to Mississippi.


Government would be tolerable if not for politicians and bureaucrats.

Avalanchez71

Stay out Itawaba County.  The SO is full of tyrants.




Opinions expressed here on belong solely to the poster and do not represent or reflect the opinions or beliefs of AARoads, its creators and/or associates.