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

Making big PDF maps

Not owning Campaign Cartographer II, I am looking for other options to produce sector maps with a bit more information than the bitmap generated from Galactic 2.4. Sadly, there's not a lot of utilities out there that seem capable of producing such. :(

This nroute app seemed like one of them, but sadly, I don't have the time to dedicate to learning C/C++ and porting this over to a Windows environment. If I'm going to do that, I may as well go the next step and convert it all to Java, so that it's more truely platform-independent, and utilize iText for the PDF creation. But that's a lot of work, with a limited amount of return, I feel. (Still, I may do it for the challenge of it all, but that's later, when I actually have time to do so.)

Any suggestions would be greatly appreciated,
Flynn
 
Perl can be downloaded from any of several places on the 'web. Once that's installed, it's just a matter of running a perl script with the intended data.

I'll dig up my script and dust it off. It's intended to take a regular sector file (*.sec) and produce a hexmap. I believe it scales the resulting file based on the hex extents detected, so if you give it a file with only a subsector in it, you'll get out a subsector map which fits on a page. If you feed in a sector, it scales the entire sector to a page. Of course, I can change that relatively easy -- or, I can also post my code which splits up a sector into subsector maps and generates PS files for each of these as well.

My full process also requires GhostScript (gswin32c last I checked), which creates a JPG from a PS. However, I find that ps2pdf.com works great!
 
That would be awesome, Robject, and muchly appreciated!
Definitely makes quandrant maps easy to make, in addition to sector and subsector maps.

Do you happen to have a sample of how such a map looks?

Thanks in advance,
Flynn
 
http://home.comcast.net/~downport/perl/Alexandria.tas
http://home.comcast.net/~downport/perl/gridps.pl

OK, there's my Perl code. You'll need both files in the same directory. All of this code is old Perl, which means it will work on old distributions of Perl 4 as well as the newer Perl 5.

Alexandria.tas - my function library
gridps.pl - my converter

On my windows machine, I run it like this:

perl gridps.pl spinward.sec

The script creates a file named spinward.ps, which is the PostScript file. Upload that to ps2pdf.com and you can get a PDF out of it.

There are some options you might like to know about:

(1) Color change

Changing this line in gridps.pl
my $negative = 0;
to this
my $negative = 1;
will produce negative-image maps: the
colors are negativized so you can take a negative of the image to produce a map that has the black background and white lines we're so used to.

(2) XBoat routes

gridps recognizes and draws X-Boat routes
that are encoded like this:

Regina 1910 A788899-C A Ri Cp 703 Im F7 V M8 D M6 V :1909,2007

In other words, a colon followed by a comma-separated list of route links.

(3) Color coding

Hexes are coded for some more common
trade codes:
Blue: water world
Green: Ag world
Gold: Rich world
Purple: Rich Ag world
Black dot: Industrial world
All caps for pop A+
Amber and Red zones are marked.
Number of GGs and Asteroid belts noted.
Bases present noted.
Allegiance noted.
Even the UWP is there (usually)

(4) Snaps-to subsector

If the extents is smaller than a subsector, it 'snaps' to subsector size. This is because I didn't want an extreme local view to create a map containing six huge hexes on a piece of paper.

(5) Subsector, sector capital

Ah, if the /Cp/ or /Cx/ 'trade codes' are present, the system name will appear in red.
 
Wow! Very nice.


Okay, now to learn how to install Perl on my machine so I can run this baby...

Thanks again,
Flynn
 
For Windows machines: If you'd also like the Apache webserver, I'd suggest IndigoPerl (indigoperl.com); otherwise I'd suggest ActiveState Perl.

If you're running Linux, some flavor of Unix, or Mac OSX, then you already have Perl.

I'm open to suggestions for improvement. Not that I have any free time (this code was written many years ago), but who knows.

The snippet above looks pretty busy; I might be talked into adding a configuration file or command-line switches that controls what gets shown and what doesn't. Or alternately, providing tools that strip information out of the sector file (which could be generally useful, no?).
 
Running Win2K, so I'm downloading ActiveState Perl right now...


There's a lot of data you've put in there, but it'd be welcome. The only minor adjustments I can think of are:

1) Centering of world name under the UWP; and
2) Providing for a better way to name the Sector overall, so that you can use the full name instead of the filename.

Those are pretty miniscule in the scheme of things, but they're suggestions, nonetheless.

Otherwise, I think it looks great.


Okay, I'm going to go play with this now,
Flynn
 
Wow, it works great!

Do you have the script that breaks a sector down into subsectors?

And how hard would it be to modify that script to take a sector file and break it down into the four quadrants?

This is very cool,
Flynn
 
Originally posted by Flynn:
Wow, it works great!

Do you have the script that breaks a sector down into subsectors?

And how hard would it be to modify that script to take a sector file and break it down into the four quadrants?

This is very cool,
Flynn
Both would be pretty straightforward. I remember actually writing those scripts before. Hang on and I'll see what I can do.

As a matter of fact, you might be able to write those types of scripts, too.

What we really want is a script that lets us extract any region of a sector map.


Perl scripts are usually written inside any old text editor. Give it a .pl ending to identify it as perl.

Let's start out with these lines:
</font><blockquote>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">use strict;
require "Alexandria.tas";</pre>[/QUOTE]The first line helps people debug problems. The second lets us leverage a very useful Traveller subroutine.

Now, for our Traveller data, we want to operate on a sector file. We also want to know what extents to extract. So we'd pass in something like this:

myprogram.pl spinward.sec 0101 0810

so our code would read a filename and two extents:

</font><blockquote>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">my $filename = shift;
my $min = shift;
my $max = shift;

#
# Let's make sure min and max are in the
# proper relationship to each other.
#
die "min MUST be spinward AND coreward of max!\n"
unless $min < $max;</pre>[/QUOTE]next, let's open up the sector file and read it in.

</font><blockquote>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">open IN, $filename || die "ERROR: file $filename not found\n";
my @dat = <IN>; # read in the whole thing
close IN;</pre>[/QUOTE]Now we want all this gunk parsed out for us.

</font><blockquote>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">my %sector = getBunchesOfWorlds( @dat );

delete $sector{minrow};
delete $sector{mincol};
delete $sector{maxrow};
delete $sector{maxcol};</pre>[/QUOTE]%sector is a table of UWP data, indexed by hex number. So now we just run through this table, and print out the entries whose hex numbers are within our required extents.

%sector also contains four pieces of meta-data: the min and max row and column detected. Those four 'delete' lines get rid of that data.

</font><blockquote>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">foreach my $hex (sort keys %sector)
{
my %world = %{$sector{$hex}};
print putWorld(%world)
if $hex >= $min
&& $hex <= $max;
}</pre>[/QUOTE](I already see things I don't like about this old code. I really should rewrite it someday.)

That's it. Call the script something like carve.pl and run it like this:

perl carve.pl spinward.sec 0101 0810 > outfile.sec
 
Not knowing Perl, I'd have to leverage generic programming knowledge to get an idea of the syntax. It's something I'm willing to attempt if you aren't able to swiftly do so, but it's better to let the experts do so for something that would appear to be relatively quick and painless for someone with knowledge of Perl. It would just take me longer, and might be more frustrating.


I appreciate it,
Flynn
 
Using the script I walked through, you could carve up a sector map into quadrants by calling it four times:

perl carve.pl spinward.sec 0101 1620 > sm_q1.sec
perl carve.pl spinward.sec 1701 3220 > sm_q2.sec
perl carve.pl spinward.sec 0121 1640 > sm_q3.sec
perl carve.pl spinward.sec 1721 3240 > sm_q4.sec

(I think that's right)

You could get subsectors by calling it 16 times (but I'd instead put 16 calls into a batch file).

And, nicest of all, you can get any other chunk of a sector out.

perl carve.pl spinward.sec 1010 1919 > teens.sec

Even more strange, you can get two disjoint sections of a sector, effectively masking out the rest of the sector data:

perl carve.pl spinward.sec 0101 0810 > ss1.sec
perl carve.pl spinward.sec 2020 3240 > lowerright.sec

type ss1.sec lowerright.sec > masked.sec
 
I used to have sector data with the XBoat routes already coded in. (Sigh) But most of that hard work got corrupted. I had routes through the Marches, Deneb, Gushemege, Core, Dagudashaag, Zarushagar, Daibei. It was so nice...
 
Can this sector thing be built without the need for Computer 1 skill level? Can a nice GUI be put on the front so that I can have fun with it? Please?
 
robject,

Minor problem. Created the carve.pl, used the parameters you suggested, and I got a distorted map that included two quadrants, not one.

It deleted the unused columns, but not the rows, sadly enough. So I get the upper-right quadrant and the lower-right quadrant when I ask for the upper-right quadrant. Same when I ask for the lower-right quadrant.

Thoughts?

-Flynn

EDIT: From looking at the data files, carve.pl is going through the array and outputting any UWP with a location between the minimum and the maximum, but doesn't hack out the UWPs for locations below the minimum row or column, or for those above the maximum row or column.
 
Elliot,

I couldn't do it, as I have no server to host it, nor do I know Perl. But the info's here for anyone that might have the knowledge and the means. If there are any takers, please feel free to undertake this challenge for the other Traveller fans out there.

Best of luck in finding volunteers, Elliot,
Flynn
 
Originally posted by Flynn:
robject,

Minor problem. Created the carve.pl, used the parameters you suggested, and I got a distorted map that included two quadrants, not one.

[...]

EDIT: From looking at the data files, carve.pl is going through the array and outputting any UWP with a location between the minimum and the maximum, but doesn't hack out the UWPs for locations below the minimum row or column, or for those above the maximum row or column.
You're right. That's my fault for not thinking about the problem. If I'm taking 1720-3240, I don't want 1801, for instance. Rats, we're going to have to crack open the Hex number and fool with it a little.
 
So, I've added a subroutine which accepts three hex numbers, and returns true if the first lies within the bounds of the other two.

</font><blockquote>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">use strict;
require "Alexandria.tas";

my $filename = shift;
my $min = shift;
my $max = shift;

#
# Let's make sure min and max are in the
# proper relationship to each other.
#
die "min MUST be spinward AND coreward of max!\n"
unless $min < $max;

open IN, $filename || die "ERROR: file $filename not found\n";
my @dat = <IN>; # read in the whole thing
close IN;

my %sector = getBunchesOfWorlds( @dat );

delete $sector{minrow};
delete $sector{mincol};
delete $sector{maxrow};
delete $sector{maxcol};

foreach my $hex (sort keys %sector)
{
my %world = %{$sector{$hex}};
print putWorld(%world)
if inside( $hex, $min, $max );
}

sub inside
{
my $hex = shift;
my $min = shift;
my $max = shift;

my ($r, $c) = $hex =~ /(\d\d)(\d\d)/;
my ($r1, $c1) = $min =~ /(\d\d)(\d\d)/;
my ($r2, $c2) = $max =~ /(\d\d)(\d\d)/;

return $r >= $r1
&& $r <= $r2
&& $c >= $c1
&& $c <= $c2;
}</pre>[/QUOTE]
 
Back
Top