2013-03-04 Text Mapper With Lines

SVG Mapper now knows how to draw lines. These lines try to flow from hex to hex...

Example input:

2114 hill
2115 hill
2213 forest
2214 forest "Delan"
2215 hill
2314 forest
2315 forest
2414 hill "Forest Bight Fortress"
2415 forest
2515 forest "Boghra Little"

2214-2615 river
river path attributes fill-opacity="0" stroke="black" stroke-width="5"

include https://alexschroeder.ch/contrib/default.txt

Result:

Dangerous Forest

I think that I’m not quite understanding how the viewBox is supposed to work. But anyway: these lines can be used for roads, rivers, borders, cliffs, and the like. If they’re very straight, they don’t look too good. There’s no random waviness. One feature I definitely have to add is providing more intermediary points such that the user can guide rivers around the hills or to allow rivers to merge.

​#SVG ​#Maps ​#Text Mapper

Comments

(Please contact me if you want to remove your comment.)

Hello there. My first time posting. Really hoping you respond. I have been playing with textmapper, learning about SVG, and trying to take it farther on my own. Things would be going much better if I was a computer programmer instead of a chemist. The Viewbox thing has been annoying for me as I have used your website to make ever more complex maps. If I could figure out how to run it locally I would, a big plus would be adding my own content to defaults.txt.

In the above image I THINK you are trying to assign the upper left and lower right corners as it shows here viewBox=”2990 2028 3910 2784”> But what you should be doing is assigning the upper left corner and then the width and height viewBox=”2990 2028 920 756”>. There is still something going on with my bigger maps but they are fully on screen when manually edited this way.

On a related note, in `black-and-white.txt`, the default attributes are `fill="#ffffff" stroke="black" stroke-width="3"` That fill attribute causes all the hexes to be blank unless I set the "fill-opacity=0.0" with manual editing. I think it should be `fill="none"`.

Yeah I really need to get this to work locally, so many possibilities.

– Craig Peters 2014-02-15 02:50 UTC

---

Wow, this is great! Regarding a local installation. What sort of computer do you have? All you really need is Apache and Perl. If you have a Mac, these come already installed. If you have a GNU/Linux system, you just need to install Apache. If you use Windows, there’s always WAMP.

WAMP

If you can’t get Apache installed but you have Perl, then you can also run the command from the command-line. It’s somewhat awkward, but if that’s how you’d prefer to use it, usability can always be improved. 😄

Here’s what I did. First I created a file in `/tmp/map.txt` containing the following

0308 jungle "Affeninsel"
include https://alexschroeder.ch/contrib/default.txt

Then I ran the command as follows:

perl text-mapper.pl map=include+file:///tmp/map.txt | tail -n +5 > map.svg

The map just needs to get an escaped URL – replace spaces with + and you should be good to go if all you do is use a simple *include* statement. The next problem is that you need to provide a local file URL. Instead of starting the URL with `http://` you start it with `file://` and then you add the file name. The script output contains some HTTP headers which you need to get rid of. I used the `tail` program, but you could just as well save the output and remove those extra lines manually:

perl text-mapper.pl map=include+file:///tmp/map.txt > map.svg

If those file URLs are giving your problems, try using your browser to “open” these files and copy the URL from the address bar.

If you’re mostly interested in providing a different default library, then all you need to do is find a site that will allow you to host text files. Perhaps a Gist on GitHub would work for you?

Gist on GitHub

Example Gist:

https://gist.github.com/1236665

Viewed as a raw text file (the link will be shown when viewing your Gist):

https://gist.github.com/avdi/1236665/raw/88d9d641375c842f978de5305d078cd763eaaf48/init.el

Or, if you decide to work locally as seen above, then your libraries can also use file URLs. 😄

As for your two bug reports: Both confirmed, fixed, and installed. Thank you very much! The viewBox issue bugged me in the past until I decided that I was no longer going to waste time looking at it. I must have gotten confused because I was computing the two corners, and then width and height, and then ignoring them and using the two corners instead.

And finally, *please share* your maps! 😄

– Alex Schroeder 2014-02-15 09:56 UTC

Alex Schroeder

---

Wow, that was fast. Thank you so much. I will try the offline thing once I load Apache and have some free hours. In the meantime here is the first of soon to be 5 maps to be used in a kingmaker D&D campaign. You have said elsewhere on this site that entering text to make a map may not be worth the trouble. I agree, but it is good for editing once you have had a look at the final map. Thats why I’m use excel to input one letter keycodes (like your oldschool mapper) that then make the HTTP using concatenate.

http://tinyurl.com/ke5ay9h in black and white http://tinyurl.com/lhfryo3 in color

http://tinyurl.com/ke5ay9h

http://tinyurl.com/lhfryo3

I’ll need to attend to ocean/sea/rivers in black and white and must not set hatched hexes to white, but its a good start. Wish me luck.

– Craig Peters 2014-02-17 04:47 UTC

---

Good luck! I like the black & white map. It has a certain lightness to it.

– Alex Schroeder 2014-02-17 06:15 UTC

Alex Schroeder