Citizens of the Imperium

Citizens of the Imperium (http://www.travellerrpg.com/CotI/Discuss/index.php)
-   Software Solutions (http://www.travellerrpg.com/CotI/Discuss/forumdisplay.php?f=63)
-   -   Making big PDF maps (http://www.travellerrpg.com/CotI/Discuss/showthread.php?t=11576)

Morte April 12th, 2004 01:34 PM

If I want to make PDF maps of sector or more size, looking roughly like a Shane's maps minus the subsector lines but with UWP data like this, what software do I need?

Can I do it free (since I only really want 2 or 3 maps)?

Elliot April 12th, 2004 01:49 PM

The usual response is Campaign Cartographer - what would be really cool is if QLI put a sector map designer pdf form thingy on the web site - (although cost of software might be too high - anyone wanna stick a freebie up?)

Slink182 April 12th, 2004 02:32 PM

I need to ask - what size paper sheet are you looking to print something like your example on? A4, A2, legal, what?

Morte April 12th, 2004 02:48 PM

It's mostly to view on screen, not for paper. I zoom in and scroll around. I don't really go in for paper much these days, but I have big dual monitors.

A decent viewing programme, with anti-aliased rendering and no arbitrary (sub)sector alignment crap, wouldn't be too bad. But I could put PDFs in a PDA, unlike most software.

Malenfant April 12th, 2004 03:11 PM

Probably can't do it for free. I'd make the map in Photoshop or Canvas or something like that, then save it as a PDF using the full version of Adobe Acrobat.

Flynn April 12th, 2004 03:36 PM

The sector maps are made using Campaign Cartographer II (now on sale at $39 instead of $79), Galactic 2.4, and a small script that can be found on the internet. After that, I think there's a lot of manipulation of images to get things looking right, but that's the basics of how maps like that can be created.

Programming anything like what's requested above would take a dedicated effort, which a lot of people are not likely to do without being paid for it. However, if you do find something like that, please let us know. [img]smile.gif[/img]

Good luck,
Flynn

tjoneslo April 12th, 2004 04:10 PM

The software used to create the map on maps.travellercentral.com is free. But you need to know a little programming to get them to come out right.

I've used Anthony's software to produce quadrant maps using the same data in PDF just because I thought they looked nicer.

the nroute program Anthony Jackon wrote writes a postscript file (which has all the data), then uses a PS2PDF (a free software package) to produce the PDF files.

Flynn April 12th, 2004 05:53 PM

Not familiar with postscript or how to use such a script, but if you could enlighten me, Obi-Wan, I would be forever in your debt...

Seeking wisdom,
Flynn

Flynn April 13th, 2004 09:47 AM

tjoneslo,

Perhaps I should clarify.... Could you provide some general instructions on how you created either sector or quadrant maps using the nroute program followed by PS2PDF?

Thanks in advance for your time,
Flynn

robject April 13th, 2004 10:15 AM

My Perl code is free, too, but it too produces PostScript files. I have to run GSView or similar to convert PS files to PDFs or JPEGs. I never heard of PS2PDF; sounds nice.

Flynn April 13th, 2004 10:20 AM

Perl code? Would you mind sharing that, and how to set it up to run? [img]smile.gif[/img]

Thanks,
Flynn

Flynn April 13th, 2004 12:03 PM

Pushing my envelope somewhat, as I'm not a C/C++ programmer, but I thought I'd see what could be done anyway...

Okay, I've tried downloading a C/C++ compiler off the internet and running nroute.c through it. Unfortunately, I get the following issues from the program itself:

</font><blockquote>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">nroute.c:
if( p = strrchr( out, '.' ) ) *p = 0;
^
nroute.c(120) : Warning 2: possible unintended assignment
if( (p = strchr( buf, '1' ))) POS=p-buf; else return;
^
nroute.c(145) : Warning 2: possible unintended assignment
if( (p = strchr( buf, '2' ))) PORT=p-buf; else return;
^
nroute.c(146) : Warning 2: possible unintended assignment
if( (p = strchr( buf, '3' ))) BASE=p-buf; else return;
^
nroute.c(148) : Warning 2: possible unintended assignment
if( (p = strchr( buf, '4' ))) TRADE=p-buf; else return;
^
nroute.c(149) : Warning 2: possible unintended assignment
if( (p = strchr( buf, '5' ))) ZONE=p-buf; else return;
^
nroute.c(150) : Warning 2: possible unintended assignment
if( (p = strchr( buf, '6' ))) GAS=p-buf+2; else return;
^
nroute.c(151) : Warning 2: possible unintended assignment
if( (p = strchr( buf, '7' ))) ALIGN=p-buf; else return;
^
nroute.c(152) : Warning 2: possible unintended assignment</pre>[/QUOTE]Any thoughts?

-Flynn

FlightCommanderSolitude April 13th, 2004 01:54 PM

Those are just warnings*, and the compilation should have produced an executable anyway, unless there were actual errors - perhaps you only posted some of the compiler's output. In any case, there aren't any errors there.

* The coder is doing two things in one go: assigning something to the variable p, and then testing the value of p; a common enough C idiom, but the compiler doesn't neccessarily know the programmer meant to do that, hence the warning.

vutpakdi April 13th, 2004 02:00 PM

Quote:

Originally posted by Flynn:
Pushing my envelope somewhat, as I'm not a C/C++ programmer, but I thought I'd see what could be done anyway...

Okay, I've tried downloading a C/C++ compiler off the internet and running nroute.c through it. Unfortunately, I get the following issues from the program itself:

</font><blockquote>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">nroute.c:
if( p = strrchr( out, '.' ) ) *p = 0;
^
nroute.c(120) : Warning 2: possible unintended assignment</pre>

Any thoughts?
[/quote]&lt;dusts off a really dusty and dirty C/C++ cap&gt; I think that those warnings should be okay (ie, whoever wrote that really did want to do the assignment and then test the result). But, that being said, it something acts funny when you run the program, you could try changing the = to ==.

Ron

Flynn April 13th, 2004 04:02 PM

Thanks, Ron,

Making those changes removed the warnings. The only errors now come from the file I'm processing itself. :(

More later,
Flynn

vutpakdi April 13th, 2004 05:17 PM

Quote:

Originally posted by Flynn:

Making those changes removed the warnings. The only errors now come from the file I'm processing itself. :(

Well, you might want/need to keep the assignments as they were since the original developer could have intended for them to be there. There should be a compiler switch to allow the executable to be built even if there are warnings but not errors(this is usually the default, I think).

I generally avoid(ed) doing assignments in conditionals for this exact reason: later on, discerning the intent is easier even if the code is more verbose.

Ron

FlightCommanderSolitude April 13th, 2004 05:19 PM

Ack! Making those changes will, of course, completely alter the logic of the program.

Straybow April 14th, 2004 03:08 AM

Programmers never document :mad:

vutpakdi April 14th, 2004 07:57 AM

Quote:

Originally posted by Straybow:
Programmers never document :mad:
Nah, some do (I do somewhat, on the rare occasions that I code these days: I'm a UI designer now). I did have a professor who declared that in code comments can be dangerous because they tend not to be updated when the code changes. He always advocated making the code as clear (if verbose) as possible and keeping comments to a minimum.

Ron

tjoneslo April 14th, 2004 10:05 AM

Gee Flynn, I didn't realise you'd actually try this.

http://www.cs.wisc.edu/~ghost/doc/AFPL/6.50/Ps2pdf.htm
This is a link to PS2PDF, which is included with most of the RedHat Linux distributions.

The NRoute code from Anthony site also assume you are running it on a Linux server (or at least a Unix one). If you are not, you will have a porting job on your hands.

As others have noted, the warnings can be ignored as the assignments in the conditionals are intentional.

Start with reviewing the blankmap.ps file (it the postscript text file that forms the basis of the postscript file you will convert later).

Next look through the nroute.c code for the show_sector () function. A careful reading of the items begin written will show how the postscript is written. And then it calls the ps2pdf to convert the postscript ot a pdf file.

I took a look this morning and realized I lost the fixes for the nroute to produce the quadrant code when the our red hat server got upgraded. If you are really interested I can reproduce it.

Otherwise, If you only want one or two, you may be able to write by hand the PS file for your notes or tweak the show_sector() code.

Don't forget though, PDF is a page oriented file format, it likes things to be on a 8x11 page (or similar).

Flynn April 14th, 2004 10:30 AM

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

savage April 14th, 2004 01:37 PM

actually cc2 dropped its price. Or so an email I received recently stated.


Savage

robject April 14th, 2004 01:43 PM

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!

Flynn April 14th, 2004 02:02 PM

That would be awesome, Robject, and muchly appreciated! [img]smile.gif[/img] 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

robject April 14th, 2004 02:10 PM

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.

robject April 14th, 2004 02:12 PM

Quote:

Originally posted by Flynn:
That would be awesome, Robject, and muchly appreciated! [img]smile.gif[/img] 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

As a matter of fact, I just uploaded the test file I used to make sure things work right:

http://home.comcast.net/~downport/perl/spinward.pdf

Flynn April 14th, 2004 02:26 PM

Wow! Very nice. [img]smile.gif[/img]

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

Thanks again,
Flynn

robject April 14th, 2004 02:31 PM

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

Flynn April 14th, 2004 02:45 PM

Running Win2K, so I'm downloading ActiveState Perl right now... [img]smile.gif[/img]

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. [img]smile.gif[/img]

Okay, I'm going to go play with this now,
Flynn

Flynn April 14th, 2004 02:58 PM

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

robject April 14th, 2004 03:13 PM

Quote:

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 &quot;Alexandria.tas&quot;;</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 &quot;min MUST be spinward AND coreward of max!\n&quot;
unless $min &lt; $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 &quot;ERROR: file $filename not found\n&quot;;
my @dat = &lt;IN&gt;; # 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 &gt;= $min
&amp;&amp; $hex &lt;= $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 &gt; outfile.sec

Flynn April 14th, 2004 03:17 PM

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. [img]smile.gif[/img]

I appreciate it,
Flynn

robject April 14th, 2004 03:46 PM

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 &gt; sm_q1.sec
perl carve.pl spinward.sec 1701 3220 &gt; sm_q2.sec
perl carve.pl spinward.sec 0121 1640 &gt; sm_q3.sec
perl carve.pl spinward.sec 1721 3240 &gt; 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 &gt; 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 &gt; ss1.sec
perl carve.pl spinward.sec 2020 3240 &gt; lowerright.sec

type ss1.sec lowerright.sec &gt; masked.sec

robject April 14th, 2004 03:55 PM

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

Flynn April 14th, 2004 04:23 PM

Very cool. My last post was made before I read your script-fix. [img]smile.gif[/img]

Am trying this out now,
Flynn

Elliot April 14th, 2004 04:28 PM

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?

Flynn April 14th, 2004 04:39 PM

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.

Flynn April 14th, 2004 04:57 PM

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

robject April 14th, 2004 05:15 PM

Quote:

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.

robject April 14th, 2004 05:19 PM

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 &quot;Alexandria.tas&quot;;

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 &quot;min MUST be spinward AND coreward of max!\n&quot;
unless $min &lt; $max;

open IN, $filename || die &quot;ERROR: file $filename not found\n&quot;;
my @dat = &lt;IN&gt;; # 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 &gt;= $r1
&amp;&amp; $r &lt;= $r2
&amp;&amp; $c &gt;= $c1
&amp;&amp; $c &lt;= $c2;
}</pre>[/QUOTE]

robject April 14th, 2004 05:22 PM

Quote:

Originally posted by Elliot:
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?
Elliot,

Yes, a nice GUI could be tacked onto it; however I'm not spectacular with GUIs. What I could do is wrap this in CGI and create an HTML interface to it. You'd cut-and-paste in the sector data (or select from a list of data on hand) and tell it how you want it carved out, and it'll return the output list. Would that work for everyone?

Flynn April 14th, 2004 05:46 PM

Nice job, robject. The new script variation works perfectly. [img]smile.gif[/img]

Thanks,
Flynn

Elliot April 15th, 2004 04:10 AM

Robject
When I say GUI I dont mean Apple Macintosh pretty, I mean something that a person like me who is 'pooter dim can use to build a sector map.

If it aint pretty but is usable it would be an absolute blessing to the world.

If you can do it, it would be cool.

robject April 15th, 2004 10:49 AM

Hmm, sounds like a mandate from the masses (and not some farcical aquatic ceremony!).

Elliot April 15th, 2004 05:47 PM

please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please pretty please

BeRKA April 16th, 2004 09:24 AM

Robject, Your script is very cool. :cool: :cool: :cool: :cool: :cool:

A webinterface would be nice. :D

If I get Your permission, (and some time to implement it) may I use this with my random subsector generator?

Cheers
/BeRKA

robject April 16th, 2004 03:52 PM

Quote:

Originally posted by BeRKA:
Robject, Your script is very cool. :cool: :cool: :cool: :cool: :cool:

A webinterface would be nice. :D

If I get Your permission, (and some time to implement it) may I use this with my random subsector generator?

Cheers
/BeRKA

Hi BeRKA, I remember you from the TML. Long time no see. Of course you may use it!

robject April 16th, 2004 04:02 PM

Quote:

Originally posted by Elliot:
please please please ...
Elliot et al,

I'm talking with Ron Brown (of Downport.com) about putting the script up on downport, where it belongs. Perhaps we can even link it to the PDF-generation facility for one-stop shopping.

Elliot April 17th, 2004 06:36 AM

wo ho!! oh yeah!!!

robject April 17th, 2004 07:37 PM

In the meantime, I have a very, very pathetic little web-based front-end to the program at:

http://24.1.3.180/tas/webps.cgi

It lets you pick the sector to convert, and spills the output to the browser. It also lets you specify sub-extents properly.

Files that have already been converted to PS format are also listed and freely available.

I've also cleaned up the sector names a bit, so that the output will look prettier; I also found the Spinward Marches sector with X-Boat routes included, to make the maps even more interesting.

Caveat Surfer. The address above is not available Monday, 19 April, because I turned the computer off. Check it again in a few hours when I get home from work.


All times are GMT -4. The time now is 01:41 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright (c) 2010-2013, Far Future Enterprises. All Rights Reserved.