AARoads Forum

Regional Boards => Mid-South => Topic started by: hbelkins on February 02, 2017, 04:30:30 PM

Title: Mississippi county collecting
Post by: hbelkins on February 02, 2017, 04:30:30 PM
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.

(https://www.aaroads.com/forum/gallery/21_02_02_17_4_26_47.jpeg)

(Crossposted to the Road Trips board...)
Title: Re: Mississippi county collecting
Post by: 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...
Title: Re: Mississippi county collecting
Post by: yakra on February 06, 2017, 11:36:40 AM
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 (http://mississippisiteselection.com/gis-data-download.aspx) / County Boundaries (http://mississippisiteselection.com/portaldata/administrative/stco.zip)

You can use QGIS (http://www.qgis.org/en/site/) 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. :)
Title: Re: Mississippi county collecting
Post by: yakra on November 19, 2017, 02:43:23 AM
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.
Title: Re: Mississippi county collecting
Post by: Jim on November 19, 2017, 07:22:50 AM
I am teaching Algorithms in the spring, so this could happen...
Title: Re: Mississippi county collecting
Post by: yakra on November 20, 2017, 11:52:18 AM
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-)
Title: Re: Mississippi county collecting
Post by: yakra on November 20, 2017, 12:02:54 PM
Jim, I've copied our discussion to the TM forum (http://tm.teresco.org/forum/index.php?topic=2291), so as not to spam up HB's post here on AARoads with a bunch of not-too-relevant stuff.
Title: Re: Mississippi county collecting
Post by: codyg1985 on November 21, 2017, 09:58:23 AM
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?
Title: Re: Mississippi county collecting
Post by: hbelkins on November 21, 2017, 10:07:46 AM
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.
Title: Re: Mississippi county collecting
Post by: Avalanchez71 on December 12, 2017, 12:41:48 PM
Stay out Itawaba County.  The SO is full of tyrants.