Author Topic: county collecting (from AARoads)  (Read 16272 times)

0 Members and 1 Guest are viewing this topic.

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4422
  • Last Login:November 11, 2024, 12:50:03 pm
  • I like C++
county collecting (from AARoads)
« on: November 20, 2017, 11:54:36 am »
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...)
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4422
  • Last Login:November 11, 2024, 12:50:03 pm
  • I like C++
Re: county collecting (from AARoads)
« Reply #1 on: November 20, 2017, 11:55:49 am »

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...
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4422
  • Last Login:November 11, 2024, 12:50:03 pm
  • I like C++
Re: county collecting (from AARoads)
« Reply #2 on: November 20, 2017, 11:56:45 am »

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.

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.
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4422
  • Last Login:November 11, 2024, 12:50:03 pm
  • I like C++
Re: county collecting (from AARoads)
« Reply #3 on: November 20, 2017, 11:57:21 am »

Quote from: Jim
I am teaching Algorithms in the spring, so this could happen...
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4422
  • Last Login:November 11, 2024, 12:50:03 pm
  • I like C++
Re: county collecting (from AARoads)
« Reply #4 on: November 20, 2017, 11:58:14 am »

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.
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)
« Last Edit: November 20, 2017, 01:13:29 pm by yakra »
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca

Offline Jim

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 2856
  • Last Login:Today at 07:44:19 am
Re: county collecting (from AARoads)
« Reply #5 on: November 20, 2017, 01:37:24 pm »
Thanks for copying this over.

Offline bejacob

  • Full Member
  • ***
  • Posts: 233
  • Last Login:Yesterday at 08:28:05 pm
Re: county collecting (from AARoads)
« Reply #6 on: November 20, 2017, 04:12:52 pm »
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.

While I enjoy being able to combine TM and county collecting, I spend more than enough time planning my own travels. This is the first time I've seen a county collector ask someone else to do his/her homework.  ;D Plot your own damn route.  ;)

As a suggestion for anyone looking for a route optimization tool, try the CoPilot app. After inputting stops along the way, there is an option to "optimize stops." It isn't free, but IMHO it's one of the better route planning/gps mapping apps.

Offline vdeane

  • Sr. Member
  • ****
  • Posts: 425
  • Gender: Female
  • Last Login:Yesterday at 10:06:23 pm
    • New York State Roads
Re: county collecting (from AARoads)
« Reply #7 on: November 26, 2017, 08:45:09 pm »
The concern I'd have with this is that it may not be completely accurate; many routes skirt county boundaries (or barely avoid a county) and this might not be captured since a lot more shaping points would be required to match the shape of the road that well.
Please note: All comments here represent my own personal opinion and do not reflect the official position of NYSDOT or its affiliates.

Offline Jim

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 2856
  • Last Login:Today at 07:44:19 am
Re: county collecting (from AARoads)
« Reply #8 on: November 26, 2017, 09:40:15 pm »
For my purposes, this is an academic exercise.  I'd only likely consider coordinates at graph vertices, so shaping points wouldn't even come into play.  It would definitely miss any cases where a route dips into a county between non-hidden waypoints.

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4422
  • Last Login:November 11, 2024, 12:50:03 pm
  • I like C++
Re: county collecting (from AARoads)
« Reply #9 on: November 27, 2017, 12:40:21 am »
Vertices of a simple graph? ;)
(It's a higher-res picture, and can more clearly capture some of those borderline cases...)
« Last Edit: November 27, 2017, 12:52:12 am by yakra »
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4422
  • Last Login:November 11, 2024, 12:50:03 pm
  • I like C++
Re: county collecting (from AARoads)
« Reply #10 on: November 27, 2017, 12:49:31 am »
Visible point, ME I-95 259...
Checking my shapefiles, the Penobscot/Aroostook line is just about exactly halfway between the two carriageways on Casey Rd, thus it's just about exactly where, theoretically, we'd want the waypoint to be.
In actuality, 45.800133°, -68.427162° will probably fall on one side or the other.
But what if -- WHAT IF -- a point falls exactly on the county line? 8)
« Last Edit: November 27, 2017, 01:00:52 am by yakra »
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca

Offline Highway63

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 538
  • Gender: Female
  • Last Login:July 03, 2024, 01:59:15 am
Re: county collecting (from AARoads)
« Reply #11 on: December 09, 2017, 12:33:04 pm »
No "what if" needed. Iowa has a bundle of points on county lines. IA 21 at US 30 and IA 8 are two such points.

Offline vdeane

  • Sr. Member
  • ****
  • Posts: 425
  • Gender: Female
  • Last Login:Yesterday at 10:06:23 pm
    • New York State Roads
Re: county collecting (from AARoads)
« Reply #12 on: December 09, 2017, 05:12:27 pm »
Also every single point on NY 272.
Please note: All comments here represent my own personal opinion and do not reflect the official position of NYSDOT or its affiliates.

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4422
  • Last Login:November 11, 2024, 12:50:03 pm
  • I like C++
Re: county collecting (from AARoads)
« Reply #13 on: December 10, 2017, 03:58:09 am »
We do need the what-if -- while these points may be understood to be on the county line in the physical world, our WPT coords will be a little off due to the way it's entered by double-clicking & centering the map. Or, due to the fact that lat/long are only stored to 6 decimal places.
For example, if we use this as the Orleans/Monroe line:
Code: [Select]
380-144 http://www.openstreetmap.org/?lat=43.284705&lon=-77.995716
380-143 http://www.openstreetmap.org/?lat=43.287380&lon=-77.995666
380-142 http://www.openstreetmap.org/?lat=43.287446&lon=-77.995665
380-141 http://www.openstreetmap.org/?lat=43.287513&lon=-77.995663
380-140 http://www.openstreetmap.org/?lat=43.292220&lon=-77.995601
380-139 http://www.openstreetmap.org/?lat=43.297559&lon=-77.995474
380-138 http://www.openstreetmap.org/?lat=43.299903&lon=-77.995441
380-137 http://www.openstreetmap.org/?lat=43.302043&lon=-77.995414
380-136 http://www.openstreetmap.org/?lat=43.302312&lon=-77.995411
380-135 http://www.openstreetmap.org/?lat=43.303156&lon=-77.995396
380-134 http://www.openstreetmap.org/?lat=43.304425&lon=-77.995374
380-133 http://www.openstreetmap.org/?lat=43.306505&lon=-77.995348
380-132 http://www.openstreetmap.org/?lat=43.308160&lon=-77.995318
380-131 http://www.openstreetmap.org/?lat=43.310426&lon=-77.995301
380-130 http://www.openstreetmap.org/?lat=43.314296&lon=-77.995252
380-129 http://www.openstreetmap.org/?lat=43.316740&lon=-77.995237
380-128 http://www.openstreetmap.org/?lat=43.317579&lon=-77.995231
380-127 http://www.openstreetmap.org/?lat=43.319384&lon=-77.995213
380-126 http://www.openstreetmap.org/?lat=43.322231&lon=-77.995229
380-125 http://www.openstreetmap.org/?lat=43.324301&lon=-77.995236
380-124 http://www.openstreetmap.org/?lat=43.326689&lon=-77.995221
380-123 http://www.openstreetmap.org/?lat=43.327835&lon=-77.995215
380-122 http://www.openstreetmap.org/?lat=43.328825&lon=-77.995211
380-121 http://www.openstreetmap.org/?lat=43.335327&lon=-77.995197
380-120 http://www.openstreetmap.org/?lat=43.337702&lon=-77.995192
380-119 http://www.openstreetmap.org/?lat=43.340076&lon=-77.995187
380-118 http://www.openstreetmap.org/?lat=43.341596&lon=-77.995177
380-117 http://www.openstreetmap.org/?lat=43.344564&lon=-77.995186
380-116 http://www.openstreetmap.org/?lat=43.348438&lon=-77.995216
380-115 http://www.openstreetmap.org/?lat=43.349577&lon=-77.995237
380-114 http://www.openstreetmap.org/?lat=43.350605&lon=-77.995255
380-113 http://www.openstreetmap.org/?lat=43.353990&lon=-77.995299
380-112 http://www.openstreetmap.org/?lat=43.355057&lon=-77.995324
380-111 http://www.openstreetmap.org/?lat=43.356258&lon=-77.995353
380-110 http://www.openstreetmap.org/?lat=43.358149&lon=-77.995418
380-109 http://www.openstreetmap.org/?lat=43.360257&lon=-77.995492
380-108 http://www.openstreetmap.org/?lat=43.360982&lon=-77.995510
380-107 http://www.openstreetmap.org/?lat=43.361645&lon=-77.995526
380-106 http://www.openstreetmap.org/?lat=43.363084&lon=-77.995565
380-105 http://www.openstreetmap.org/?lat=43.363814&lon=-77.995584
380-104 http://www.openstreetmap.org/?lat=43.364872&lon=-77.995638
380-103 http://www.openstreetmap.org/?lat=43.364963&lon=-77.995638
380-102 http://www.openstreetmap.org/?lat=43.365118&lon=-77.995637
380-101 http://www.openstreetmap.org/?lat=43.365146&lon=-77.995644
NY NY272 NY18_E is slightly -- but clearly -- on the Monroe side.
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca