• Welcome to the new COTI server. We've moved the Citizens to a new server. Please let us know in the COTI Website issue forum if you find any problems.
  • We, the systems administration staff, apologize for this unexpected outage of the boards. We have resolved the root cause of the problem and there should be no further disruptions.

TravellerMap.com API Update

WOW! That page blows everyone away! Check my posting of traveller items i have and I will be glad to research my books for what ever you might need.

Douglas
 
And since it felt incomplete...

You can now get routes/borders/labels by specifying XML formatted metadata as a second attachment. (Sorry, no MSEC support.)
 
Yes, wow... but it would be really awesome to be able to get URL's on map, too...
 
One more quick feature add:

http://www.travellermap.com/post.htm

You can now use HTTP POST to supply data used for the Poster API rendering. In English: you can upload custom SEC data and have it rendered.

Holy crap!

:toast:

I think my head just exploded! :D

Thanks, Josh! That was a great Christmas present! It sure as hell saved me (and probably a lot of others as well) a lot of work. (not that we won't peck around, of course :) )
 
Bowing to popular demand, you can now do:

http://www.travellermap.com/SEC.aspx?sector=Spinward+Marches to get the data behind a sector.

* I may remove this feature
* It is only as good as the source data and my parser; worlds may very well go missing!
* My site does not consume stellar data, so even if present in my source data it is dropped on the floor. I will add that at some point.
* The column widths are undefined (and may be dynamic at some point); you'll want to use regular expressions to parse the data
 
You're just doing this to force me to refresh myself on *&#%$ regex aren't you?

The previous expletive will probably actually do something if you are using a *nix box and preface it with "perl " :P

Looking very pretty, I hope you don't get too much time off your "real" job to do this, or I'll get downright demotivated ;)

Scott Martin
 
Heh. I have C# and Perl regex examples available, and robject has a published Perl library including regex parsers.

There are really only two tricky bits to parsing UWPs with regex: distinguishing name from hex and codes from bases/zones, since you have to assume some minimal length for fields. I don't have the code in front of me, but I believe I use something like:

^(.{15,}) +(\d\d\d\d) +(\w\w\w\w\w\w\w-\w) +(\w| ) +(.{15,}) +(\w| ) +([0-9][0-9A-F][0-9A-F]) +(\w\w)


In English, this translates to:
* Capture name (at least 15 characters)
* Capture hex (4 digits)
* Capture UWP (XXXXXXX-X)
* Capture base (single character, may be blank)
* Capture codes (at least 15 characters)
* Capture zone (single character, may be blank)
* Capture PBG (3 "hex" digits)
* Capture allegiance (2 characters)

Anything after that is either stellar data or an extension, which I ignore. You have to do whitespace trimming on various fields and handle special cases (like . as a name terminator in some T4-era files; some un-named worlds have the hex name as their name so you can blank that out)

This handles about 99% of the lines in random SEC files, but that 1% is pretty big, with fun things like:
* I l and O in place of digits, especially in PBG
* Space instead of - in the UWP
* Missing PBG altogether
* Extra fields proposed at various times
* Funky allegiances (e.g. "JP/Jm")

See http://travellermap.blogspot.com/search/label/bug fixes for the trials and tribulations
 
wouldn't +(\w\w\w\w\w\w\w-\w) be able to handle the space with something akin to: +(\w\w\w\w\w\w\w[\-\ –—]\w)

(I'm not up on my escaping within regex, but I believe that should work to include space, dash, em-dash, and en-dash in the uwp
 
wouldn't ... be able to handle ...

Oh, yes - I just was trying not to scare away folks already scared of regular expressions. :)

Here's the C# version my site actually uses:

private static readonly Regex worldRegex = new Regex(
@"^" +
@"( \s* (?<name> [^\s.](.*?[^\+\s.])? ) )? \+?\.* " + // Name
@"( \s* (?<hex> \d\d\d\d ) ) " + // Hex
@"( \s+ (?<uwp> \w{7}-\w ) ) " + // UWP (Universal World Profile)
@"( \s+ (?<base> \w | \* ) )? " + // Base
@"( \s{1,3} (?<codes> .{10,}? ) ) " + // Codes
@"( \s+ (?<zone> \w ) )? " + // Zone
@"( \s+ (?<pbg> \d[0-9A-F][0-9A-F] ) ) " + // PGB (Population multiplier, Belts, Gas giants)
@"( \s+ (\w\w\/)? (?<allegiance> (\w\w\b|\w-|--) ) ) " + // Allegiance
@"( \s* (?<stellar> .* ) ) "// Stellar data (etc)


, RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Singleline | RegexOptions.ExplicitCapture | RegexOptions.IgnorePatternWhitespace );


Apparently I've actually done some data cleanup on the files, because I am just using \w\w\w\w\w\w\w-\w for UWPs.
 
Out of curiosity, why does the PBG regex use the hex codes? Are there files you have encountered that use them?
 
Yeah... most of them are from the Undeveloped Sectors (http://homepage.ntlworld.com/elvwood/Traveller/Sectors/) project:

Angfutsag.sec: . 1931 X768000-0 Ba Lo Ni 00A -- F8V M7D F3V
Angfutsag.sec: Kezsueth 1840 D635944-5 Hi In 51C Va F8V M3D M1D
Finggvakhou.sec: . 2122 X355000-0 Ba Lo Ni 02A -- F1V M7D M6D
Finggvakhou.sec: . 3232 X304000-0 Ba Ic Lo Ni Va 01A -- M3V M1V F7D
Gakghang.sec: . 1139 X675000-0 Ba Lo Ni 04A -- G7V M1D F7V
Gelath.sec: Paeemugn!' 3233 C78A561-F K Ni Wa 52B Kk K6V M8D M7D
Ghoekhnael.sec: . 0208 X100000-0 Ba Lo Ni Va 00B -- K2V G0V M2D
Gzaekfueg.sec: Errkfaekso 2709 E210002-2 C Lo Ni 90A V5 M7V M1D M8V
Rfigh.sec: . 0222 X614000-0 Ba Ic Lo Ni 01B -- M7V M7D M0D
windhorn.sec: Knueavilighz 3023 D8B6978-7 C Fl Hi In 60A V7 M5V M4D
ziafrfplians.sec: Rroakhin 2710 B447577-8 G Ag Ni 20C Vp G8V M1D G1D

The TravMapper program floating around the 'net (which I used for the Solomani and Aslan Dotmap Reconstruction) will generate PBGs with : and ; in them since ASCII goes: 0123456789:;<=>? - I manually edited overflows to be "9"... but looks like I missed one:

Kaa G!kul.sec: Hicongengiso 1935 C343783-6 Ag Po 21; Hv K0V M8D M4D

On a tangent - there's a copy of this sector by Leroy Gautney on the HIWG CD... let the debates begon.
 
Back
Top