0 Members and 1 Guest are viewing this topic.

yakra

• TM Collaborator
• Hero Member
• Posts: 1349
• Last Login:Today at 04:33:23 pm
« on: November 20, 2017, 11:54:36 am »

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...)

yakra

• TM Collaborator
• Hero Member
• Posts: 1349
• Last Login:Today at 04:33:23 pm
« 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...

yakra

• TM Collaborator
• Hero Member
• Posts: 1349
• Last Login:Today at 04:33:23 pm
« 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.

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.

yakra

• TM Collaborator
• Hero Member
• Posts: 1349
• Last Login:Today at 04:33:23 pm
« Reply #3 on: November 20, 2017, 11:57:21 am »

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

yakra

• TM Collaborator
• Hero Member
• Posts: 1349
• Last Login:Today at 04:33:23 pm
« 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?
« Last Edit: November 20, 2017, 01:13:29 pm by yakra »

Jim

• TM Collaborator
• Hero Member
• Posts: 1156
• Last Login:Today at 03:16:16 pm
« Reply #5 on: November 20, 2017, 01:37:24 pm »
Thanks for copying this over.

bejacob

• Full Member
• Posts: 105
• Last Login:July 16, 2018, 06:27:50 pm
« 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.  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.

vdeane

• Jr. Member
• Posts: 70
• Gender:
• Last Login:Yesterday at 05:29:16 pm
« 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.

Jim

• TM Collaborator
• Hero Member
• Posts: 1156
• Last Login:Today at 03:16:16 pm
« 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.

yakra

• TM Collaborator
• Hero Member
• Posts: 1349
• Last Login:Today at 04:33:23 pm
« 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 »

yakra

• TM Collaborator
• Hero Member
• Posts: 1349
• Last Login:Today at 04:33:23 pm
« 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?
« Last Edit: November 27, 2017, 01:00:52 am by yakra »

Highway63

• TM Collaborator
• Full Member
• Posts: 126
• Last Login:July 08, 2018, 01:00:23 am
« 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.

vdeane

• Jr. Member
• Posts: 70
• Gender:
• Last Login:Yesterday at 05:29:16 pm
« 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.

yakra

• TM Collaborator
• Hero Member
• Posts: 1349
• Last Login:Today at 04:33:23 pm
`380-144 http://www.openstreetmap.org/?lat=43.284705&lon=-77.995716380-143 http://www.openstreetmap.org/?lat=43.287380&lon=-77.995666380-142 http://www.openstreetmap.org/?lat=43.287446&lon=-77.995665380-141 http://www.openstreetmap.org/?lat=43.287513&lon=-77.995663380-140 http://www.openstreetmap.org/?lat=43.292220&lon=-77.995601380-139 http://www.openstreetmap.org/?lat=43.297559&lon=-77.995474380-138 http://www.openstreetmap.org/?lat=43.299903&lon=-77.995441380-137 http://www.openstreetmap.org/?lat=43.302043&lon=-77.995414380-136 http://www.openstreetmap.org/?lat=43.302312&lon=-77.995411380-135 http://www.openstreetmap.org/?lat=43.303156&lon=-77.995396380-134 http://www.openstreetmap.org/?lat=43.304425&lon=-77.995374380-133 http://www.openstreetmap.org/?lat=43.306505&lon=-77.995348380-132 http://www.openstreetmap.org/?lat=43.308160&lon=-77.995318380-131 http://www.openstreetmap.org/?lat=43.310426&lon=-77.995301380-130 http://www.openstreetmap.org/?lat=43.314296&lon=-77.995252380-129 http://www.openstreetmap.org/?lat=43.316740&lon=-77.995237380-128 http://www.openstreetmap.org/?lat=43.317579&lon=-77.995231380-127 http://www.openstreetmap.org/?lat=43.319384&lon=-77.995213380-126 http://www.openstreetmap.org/?lat=43.322231&lon=-77.995229380-125 http://www.openstreetmap.org/?lat=43.324301&lon=-77.995236380-124 http://www.openstreetmap.org/?lat=43.326689&lon=-77.995221380-123 http://www.openstreetmap.org/?lat=43.327835&lon=-77.995215380-122 http://www.openstreetmap.org/?lat=43.328825&lon=-77.995211380-121 http://www.openstreetmap.org/?lat=43.335327&lon=-77.995197380-120 http://www.openstreetmap.org/?lat=43.337702&lon=-77.995192380-119 http://www.openstreetmap.org/?lat=43.340076&lon=-77.995187380-118 http://www.openstreetmap.org/?lat=43.341596&lon=-77.995177380-117 http://www.openstreetmap.org/?lat=43.344564&lon=-77.995186380-116 http://www.openstreetmap.org/?lat=43.348438&lon=-77.995216380-115 http://www.openstreetmap.org/?lat=43.349577&lon=-77.995237380-114 http://www.openstreetmap.org/?lat=43.350605&lon=-77.995255380-113 http://www.openstreetmap.org/?lat=43.353990&lon=-77.995299380-112 http://www.openstreetmap.org/?lat=43.355057&lon=-77.995324380-111 http://www.openstreetmap.org/?lat=43.356258&lon=-77.995353380-110 http://www.openstreetmap.org/?lat=43.358149&lon=-77.995418380-109 http://www.openstreetmap.org/?lat=43.360257&lon=-77.995492380-108 http://www.openstreetmap.org/?lat=43.360982&lon=-77.995510380-107 http://www.openstreetmap.org/?lat=43.361645&lon=-77.995526380-106 http://www.openstreetmap.org/?lat=43.363084&lon=-77.995565380-105 http://www.openstreetmap.org/?lat=43.363814&lon=-77.995584380-104 http://www.openstreetmap.org/?lat=43.364872&lon=-77.995638380-103 http://www.openstreetmap.org/?lat=43.364963&lon=-77.995638380-102 http://www.openstreetmap.org/?lat=43.365118&lon=-77.995637380-101 http://www.openstreetmap.org/?lat=43.365146&lon=-77.995644`NY NY272 NY18_E is slightly -- but clearly -- on the Monroe side.