Author Topic: Tennessee State Highways (usatn)  (Read 39025 times)

0 Members and 1 Guest are viewing this topic.

Offline mapcat

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 1627
  • Last Login:March 26, 2024, 09:50:25 am
Re: Tennessee State Highways (usatn)
« Reply #75 on: August 17, 2017, 03:54:55 pm »
A script to replace TNs by TN in all wpt files of TN region?
There are 599 left in TN region. Replacing is a maximum 30s job with Notepad++, plus commit+sync+pull request... Should I do it (tomorrow)?

(I already invested more time to write this post...)

30 seconds? Including checking for and deprecating the ones in use?
Clinched:

Offline michih

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4555
  • Last Login:Yesterday at 04:04:16 pm
Re: Tennessee State Highways (usatn)
« Reply #76 on: August 17, 2017, 04:15:33 pm »
True. Sorry, I forgot the 232 wps in use containing TNs...

I should read posts more carefully...
« Last Edit: August 17, 2017, 04:18:28 pm by michih »

Offline compdude787

  • TM Collaborator
  • Sr. Member
  • *****
  • Posts: 298
  • Gender: Male
  • Last Login:February 09, 2024, 02:19:30 am
Re: Tennessee State Highways (usatn)
« Reply #77 on: August 17, 2017, 05:16:17 pm »
Why were they done as "TNs" in the first place?

Offline mapcat

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 1627
  • Last Login:March 26, 2024, 09:50:25 am
Re: Tennessee State Highways (usatn)
« Reply #78 on: August 17, 2017, 11:28:17 pm »
Why were they done as "TNs" in the first place?
Tennessee has two different signs, one for primary routes and one for secondary. When usaus, usausb, etc were drafted, the sign difference was considered evidence of two separate systems. But since routes can switch from primary to secondary seemingly arbitrarily, and because routes designated primary in documentation are sometimes signed secondary in the field (or vice versa), it seemed more reasonable to draft one usatn set instead of two.
Clinched:

Offline rickmastfan67

  • TM Collaborator (A)
  • Hero Member
  • *****
  • Posts: 1829
  • Gender: Male
  • Last Login:Today at 06:11:34 am
Re: Tennessee State Highways (usatn)
« Reply #79 on: August 18, 2017, 04:51:44 am »
Quote
TN392: TNs101_N -> TN101_N; TNs101_S -> TN101_S (check concurrent US127Alt)

Fixed TN381 & 392. Jim & I may eventually find a way to automate the TNs -> TN adjustment in the active systems.

Sorry for all that work. lol.  At the time, Tim thought it was a good idea. lol.

Offline mapcat

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 1627
  • Last Login:March 26, 2024, 09:50:25 am
Re: Tennessee State Highways (usatn)
« Reply #80 on: August 18, 2017, 05:01:01 am »
Sorry for all that work. lol.  At the time, Tim thought it was a good idea. lol.

No worries...it would have been a lot harder to switch from all TN labels to a mix of TN and TNs if your initial decision was different and you changed your mind later.
Clinched:

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4234
  • Last Login:February 13, 2024, 07:19:36 pm
  • I like C++
Re: Tennessee State Highways (usatn)
« Reply #81 on: August 22, 2017, 03:58:47 am »
Writing a script or program to do this may be fairly simple. You could even have it check pointsinuse.log to avoid putting extraneous AltLabels in the output files.
Only thing to watch out for would be label collisions, E.G. TNs101_N -> TN101_N if there's already a TN101_N elsewhere in the file. I see these being flagged, to be manually inspected and dealt with.

Heck, I could borrow a lot of classes and functions from GISplunge, and be a good ways toward seeing some progress...
This is a work in progress.
So far, I'm at the point of identifying TNs labels and checking for potential label collisions, E.G. a primary label of TNs105 vs. a primary label or AltLabel of TN105, +TN105, or *TN105 anywhere in the file.
Next tasks:
• check labelsinuse, and relabel or demote points as appropriate
• create a CSV log of each TNs point and its fate (Relabeled, Demoted, NeedsManualCheck)
   - add a System column
• for routes that have changed, write a new file
• automate processing via a chopped routes CSV
   - load WPTs from system subdirectories
   - save WPTs into system subdirectories
« Last Edit: August 22, 2017, 05:48:20 pm by yakra »
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4234
  • Last Login:February 13, 2024, 07:19:36 pm
  • I like C++
Re: Tennessee State Highways (usatn)
« Reply #82 on: August 22, 2017, 05:32:38 pm »
Almost ready to run this thing up the flagpole & see if anyone salutes.

All I have to do is:
• Get all the WPT files onto disk.
• Create a custom CSV full of all routes in TN, to automate processing
   - usai
   - usaif
   - usaky
   - usanp
   - usansf
   - usasf
   - usatn
   - usaus
   - usausb
« Last Edit: August 22, 2017, 06:16:00 pm by yakra »
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4234
  • Last Login:February 13, 2024, 07:19:36 pm
  • I like C++
Re: Tennessee State Highways (usatn)
« Reply #83 on: August 22, 2017, 06:24:20 pm »
Yes, yes, good, good...
I'll create a branch on GitHub, upload the results,and check out the DIFFs shortly...
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca

Offline mapcat

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 1627
  • Last Login:March 26, 2024, 09:50:25 am
Re: Tennessee State Highways (usatn)
« Reply #84 on: August 22, 2017, 07:04:18 pm »
Thanks for working on this!

Activation pull submitted.
Clinched:

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4234
  • Last Login:February 13, 2024, 07:19:36 pm
  • I like C++
Re: Tennessee State Highways (usatn)
« Reply #85 on: August 22, 2017, 07:37:56 pm »
Glitches in some output files, possibly due to a missing terminal line feed:
tn.tn386.wpt

tn.us031busfra.wpt
tn.us041altbypcla.wpt
tn.us045ebusmar.wpt
tn.us045wbushum.wpt
tn.us051busdye.wpt
tn.us064bypcle.wpt
tn.us070altbyphum.wpt
tn.us070altgib.wpt
tn.us070buscam.wpt
tn.us070busdic.wpt
tn.us070busleb.wpt
tn.us079byphum.wpt
tn.us127altcro.wpt
tn.us321busgre.wpt
tn.us412buscol.wpt

tn.us011w.wpt
tn.us019.wpt
tn.us019e.wpt
tn.us023.wpt
tn.us025.wpt
tn.us025e.wpt
tn.us031e.wpt
tn.us031w.wpt
tn.us045.wpt
tn.us045w.wpt
tn.us074.wpt
tn.us421.wpt


What looks good so far is that all these files are from the very first Tennessee commit 2 years ago.

Going to resave these files, and run again.
Edit: Loaded each file into Pluma, and resaved without editing. Filesize increased by 1 byte every time. This is a good sign.
« Last Edit: August 22, 2017, 08:25:56 pm by yakra »
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4234
  • Last Login:February 13, 2024, 07:19:36 pm
  • I like C++
Re: Tennessee State Highways (usatn)
« Reply #86 on: August 22, 2017, 09:13:22 pm »
BOOM.
HighwayData-master.zip downloaded 2017-08-22 17:32:28.
pointsinuse.log downloaded 2017-08-22 11:33:36.

@mapcat, take a gander...
Files are here.
Comparison & DIFFs vs. master.
ChangeLog of TNs points detected, and their fates.
  (Nota bene: This file is contained in a different branch from that in the first two links. That way, you can pull the TNsRelabel branch into master, or your own branch, without dragging label_changelog.csv along.)

Of particular note:
Code: [Select]
System;Route;Point;Fate
usaus;tn.us011e.wpt;TNs66;NeedsManualCheck
usaus;tn.us070.wpt;TNs155;NeedsManualCheck
usaus;tn.us070s.wpt;TNs155;NeedsManualCheck
usaus;tn.us321.wpt;TNs67_W;NeedsManualCheck
usausb;tn.us041altnas.wpt;TNs155;NeedsManualCheck
Meaning US11E already has a TN66, US70 already has a TN155 (AltLabel in this case), etc.
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4234
  • Last Login:February 13, 2024, 07:19:36 pm
  • I like C++
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4234
  • Last Login:February 13, 2024, 07:19:36 pm
  • I like C++
Re: Tennessee State Highways (usatn)
« Reply #88 on: August 22, 2017, 11:26:33 pm »
OK, this is weird. I happened across a glitch in my code after this was all done...

The following code shouldn't have worked...
Quote
void demote(char *newPriLbl)
{       char **newLblArray = new char*[NumLabels+1];
        newLblArray[0] = newPriLbl;
        for (unsigned short i=0; i < NumLabels; i++)
                newLblArray[i+1] = label;
        label = newLblArray;
        NumLabels++;
        char *FirstAlt = new char[strlen(label[1])];
        strcpy(FirstAlt, "+");
        strcat(FirstAlt, label[1]);
        delete label[1];
        label[1] = FirstAlt;
}

(I'd think I'd have wanted to do this instead:)
Quote
void demote(char *newPriLbl)
{       char **newLblArray = new char*[NumLabels+1];
        newLblArray[0] = newPriLbl;
        for (unsigned short i=0; i < NumLabels; i++)
                newLblArray[i+1] = label;
        label = newLblArray;
        NumLabels++;
        char *FirstAlt = new char[strlen(label[1])+1];
        strcpy(FirstAlt, "+");
        strcat(FirstAlt, label[1]);
        delete label[1];
        label[1] = FirstAlt;
}
...but it did work. (Was I just smashing the stack without realizing it, with no ill effects?)
From what I saw of the diffs, I saw no glitches at the end of the demoted labels (former primary labels, now the first AltLabels).

But let's keep our eyes peeled, eh?
If bad comes to worse and we *do* find glitches, I can just fix my code and rerun the program.
And the advantage to that would be, no need to worry about merge conflicts. :D
« Last Edit: November 03, 2017, 12:43:28 pm by yakra »
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4234
  • Last Login:February 13, 2024, 07:19:36 pm
  • I like C++
Re: Tennessee State Highways (usatn)
« Reply #89 on: August 23, 2017, 12:09:37 am »
I just gave the DIFFs a closer look over, and all the demoted labels look fine, despite the foregoing.
Thankfully, the way GitHub highlights the DIFFs made this an easy task.
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca