User Discussions > Other Discussion

county collecting (from AARoads)

(1/3) > >>

yakra:
https://www.aaroads.com/forum/index.php?topic=19635



--- Quote from: 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...)

--- End quote ---

yakra:


--- Quote from: 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...

--- End quote ---

yakra:


--- Quote from: yakra ---I now have WPT files for each of 82 counties. 8-)


--- Quote from: SHP file format spec ---A 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.
--- End quote ---

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.
--- End quote ---

yakra:


--- Quote from: Jim ---I am teaching Algorithms in the spring, so this could happen...

--- End quote ---

yakra:


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

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 spec ---A 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.
--- End quote ---
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)

--- End quote ---

Navigation

[0] Message Index

[#] Next page

Go to full version