Giter VIP home page Giter VIP logo

7dtd-leaflet's Introduction

7DTD-leaflet

Merge 7DTD discovered map in html

The python script map_reader.py will extract dans merge all .map files of a random world. The result is then saved into png files.

A javascript code (Leaflet) merge all this png files while browsing the big map.

7DTD forum post https://7daystodie.com/forums/showthread.php?14947-Export-discovered-map-to-png

How to use

From source

Install:

Run map_reader.py by double clicking on this file. A gui will ask you the path of the .map folder. (for me this is in C:\Users\cumu\AppData\Roaming\7DaysToDie\Saves\Random Gen\testalpha\Player)

Using prebuilt binary

You will find windows binary in the releases. Place the .exe file into the extracted source file (along index.html file) https://github.com/nicolas-f/7DTD-leaflet/releases

Then double click on the exe. A gui will ask you the path of the .map folder. (for me this is in C:\Users\cumu\AppData\Roaming\7DaysToDie\Saves\Random Gen\testalpha\Player)

How to view the result

A sub directory named tiles will be created.

Open index.html in your browser (Firefox or Chrome).

Enjoy !

Command line

You can also use it in command line.

python map_reader.py -g "C:\Users\CUMU\Documents\7 Days To Die\Saves\Random Gen\ver91\Player"

Available parameters:

-g "C:\\Users..\" The folder that contain .map files
-t "tiles" The folder that will contain tiles (Optional)
-z 8 Zoom level 4-n. Number of tiles to extract around position 0,0 of map. It is in the form of 4^n tiles.It will extract a grid of 2^n*16 tiles on each side.(Optional)
-n Keep track of updates and write the last version of tiles. This will show players bases on map.

Additonnal content

You can run simple_server.py with python to give access on http://localhost:8000 .

Remember that python files are under GPLv3 license and then you need to redistribute your modifications.

7dtd-leaflet's People

Contributors

ketchu13 avatar nicolas-f avatar ninininininininini avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

7dtd-leaflet's Issues

Versioning (timestamps)

It appears that the app itsef (files, output) doesn't carry a visible version number or datestamp.

--newest

The parameter "newest" doesn't work as -newest nor --newest (on linux).
Also note that option -newest is a set of parameters -n -e -w -e -s and -t while --newest is a modifier.

Rendering error with rivers with A11

Hello!

I've noticed that since A11, rivers are rendered partially in black. While not breaking anything, it looks quite ugly :)

7d2d_river_rendering_black-issue

Kind Regards

  • G

only most recent map file is processed

with 1.2.2 only the most recent map file (access/modify time) is processed.

ls /home/onebit/code/7dtd-leaflet/maps/

▕ -rw-r--r--▏onebit:users│21 sec │   1M│1.map
▕ -rw-r--r--▏onebit:users│17 sec │   5M│2.map
▕ -rw-r--r--▏onebit:users│14 sec │   1M│3.map

python map_reader.py -g "/home/onebit/code/7dtd-leaflet/maps/"

Read map file  3.map 1 / 3
Write tile X: 28  of  256
Write tile X: 55  of  256
Write tile X: 82  of  256
Write tile X: 109  of  256
Write tile X: 128  of  256
Write tile X: 143  of  256
Write tile X: 170  of  256
Write tile X: 197  of  256
Write tile X: 224  of  256
Write tile X: 251  of  256
Min max tiles minx: -126  maxx: 52 miny: -66  maxy:  70
Tiles used / total read 10609  /  10609
Zoom level  7 ,  73  tiles left

touch 1.map
ls /home/onebit/code/7dtd-leaflet/maps/

▕ -rw-r--r--▏onebit:users│<  sec │   1M│1.map
▕ -rw-r--r--▏onebit:users│47 sec │   5M│2.map
▕ -rw-r--r--▏onebit:users│44 sec │   1M│3.map

python map_reader.py -g "/home/onebit/code/7dtd-leaflet/maps/"

Read map file  1.map 1 / 3
Write tile X: 28  of  256
Write tile X: 55  of  256
Write tile X: 82  of  256
Write tile X: 108  of  256
Write tile X: 128  of  256
Write tile X: 143  of  256
Write tile X: 170  of  256
Write tile X: 197  of  256
Write tile X: 224  of  256
Write tile X: 251  of  256
Min max tiles minx: -126  maxx: 52 miny: -66  maxy:  70
Tiles used / total read 10609  /  10609
Zoom level  7 ,  73  tiles left

v1.3.2 exe file not working (v1.3.0 did, befure 11.5 update)

Issue originally noted this issue here:
https://7daystodie.com/forums/showthread.php?14947-Export-discovered-map-to-png/page9

But I thought I'd post it here to make it more "official" :-)

-Skier

[error message]
C:\Scripts\7DTD>Update_7DTD_Map.bat
WARNING: file already exists but should not: C:\Users\ADMINI~1\AppData\Local\Temp\2_MEI13882\include\pyconfig.h
Welcome to 7DTD leflet builder version 1.3.2
This program require:
Pillow https://pillow.readthedocs.org/en/latest/

Traceback (most recent call last):
File "", line 39, in
NameError: name 'exit' is not defined
[/error message]

It gets to the "Pillow" line, then stops there... If I then hit enter, it gives the rest of the text above, and exits.

I looked in the temp directory it references, and I deleted that directory and tried again, but I get the same results.

-Skier[/QUOTE]

-m or -g parameter

When running the latest I get this error on Debian 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64 GNU/Linux, Python 2.7.3 (latest, Debian):

Adding the -m parameter halts at

7DTD-leaflet-1.2# python map_reader.py -m "/home/sdtd/instances/One/Random Gen/One/Player"

Usage:
 -m "C:\Users..":        The folder that contain .map files
 -t "tiles":             The folder that will contain tiles (Optional)
 -z 8:                           Zoom level 4-n. Number of tiles to extract around position 0,0 of map. It is in the form of 4^n tiles.It will extract a grid of 2^n*16 tiles on each side.(Optional)

Where it just sits and waits for keypress after which it returns to command prompt.

So it looks like there is the same typo from v1.0 at

        for opt, value in getopt.getopt(sys.argv[1:], "g:")[0]:
            if opt == "-g":

which should be (or changed in the help description to -g)

        for opt, value in getopt.getopt(sys.argv[1:], "m:")[0]:
            if opt == "-m":

after which it works.

not enough image data

Because of unknown issue (on debian) with v1.21.
No changes since last succesful run.
I've also noticed it doesn't render the complete map, never has, not even nearly.
Happens now on every run (does not complete):

Write tile X: 83 of 256
Write tile X: 84 of 256
Write tile X: 85 of 256
Write tile X: 86 of 256
Write tile X: 87 of 256
Write tile X: 88 of 256
Write tile X: 89 of 256
Traceback (most recent call last):
File "map_reader.py", line 256, in
main()
File "map_reader.py", line 253, in main
create_tiles(map_files, tile_path, tile_zoom)
File "map_reader.py", line 82, in create_tiles
create_base_tiles(player_map_path, tile_output_path, tile_level)
File "map_reader.py", line 131, in create_base_tiles
tile_im = Image.frombuffer('RGB', (16, 16), tile_data, 'raw', 'BGR;15', 0, 1)
File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 1858, in frombuffer
return fromstring(mode, size, data, decoder_name, args)
File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 1797, in fromstring
im.fromstring(data, decoder_name, args)
File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 594, in fromstring
raise ValueError("not enough image data")
ValueError: not enough image data

Feature Request: Label coordinates

Hi!

Me again ;) My fellow survivors asked me to open a feature request.

Basically it would be very neat to be able to set "Labels" or mark spots on the map by using a text or xml file with a format like [x,y,text]. We certainly would love to have a in-browser editor for this, but that would probably be overkill and lots of effort ;)

Example on a minecraft mapper: http://mindcrack.altervista.org/images/day.png

Thank you for your time and effort!

KR,

  • G

Player .map file renders wrong and "covers up" the map with green color

This issue happened on A10.4 (and might still be valid for A11, but unconfirmed). The server has been played on for months by many people, so the map is quite large already. A few weeks ago, suddenly the map was covered in "green stuff" render errors that would cover up explored terrain of other players. By the path we could determine that one of the players .map file might be corrupt and causing this:

7d2d_map_file_green_stuff_issue_1

Here is a "close up" of the green stuff, maybe the texture pattern is a hint:
7d2d_map_file_green_stuff_issue_2

Maybe the filesizes are a problem, at least one map file is >64MB:

23M 765611790578462.map
1.1M 76561791098418.map
24M 76561197270435.map
1.1M 76561197920365.map
21M 76561199387298.map
6.2M 76561100587548.map
20M 76561100515780.map
5.3M 76561802282848.map
5.3M 76561809453547.map
17M 765611039751818.map
5.6M 76561906756211.map
3.9M 765611818388244.map
65M 765611869575889.map

Here is the output of the renderscript, it does not show any errors that i could see:
Read map file 76561198169575889.map 1 / 13
Read map file 76561197970578462.map 2 / 13
Read map file 76561198004587548.map 3 / 13
Read map file 76561198006515780.map 5 / 13
Read map file 76561197998387298.map 6 / 13
Read map file 76561198039751818.map 7 / 13
Read map file 76561197972270435.map 9 / 13
Read map file 76561198022282848.map 10 / 13
Write tile X: 5 of 256
Write tile X: 32 of 256
Write tile X: 59 of 256
Write tile X: 86 of 256
Write tile X: 113 of 256
Write tile X: 122 of 256
Write tile X: 126 of 256
Write tile X: 129 of 256
Write tile X: 131 of 256
Write tile X: 134 of 256
Write tile X: 136 of 256
Write tile X: 138 of 256
Write tile X: 140 of 256
Write tile X: 142 of 256
Write tile X: 144 of 256
Write tile X: 146 of 256
Write tile X: 148 of 256
Write tile X: 153 of 256
Write tile X: 159 of 256
Write tile X: 169 of 256
Write tile X: 182 of 256
Write tile X: 207 of 256
Write tile X: 234 of 256
Min max tiles minx: -272 maxx: 904 miny: -1027 maxy: 757
Tiles used / total read 212039 / 212039
Zoom level 7 , 1404 tiles left
Zoom level 7 , 1178 tiles left
Zoom level 7 , 942 tiles left
Zoom level 7 , 712 tiles left
Zoom level 7 , 491 tiles left
Zoom level 7 , 263 tiles left
Zoom level 7 , 47 tiles left
Zoom level 6 , 301 tiles left
Zoom level 6 , 71 tiles left
Zoom level 5 , 17 tiles left

We appreciate your great tool and hope that it will be continued for new versions of 7D2D :)

Kind regards,

  • G

No module named _tkinter

When running the latest I get this error on Debian 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64 GNU/Linux, Python 2.7.3 (latest, Debian):

7DTD-leaflet-1.0# python map_reader.py

Traceback (most recent call last):
  File "map_reader.py", line 252, in <module>
    main()
  File "map_reader.py", line 235, in main
    import tkFileDialog
  File "/usr/lib/python2.7/lib-tk/tkFileDialog.py", line 43, in <module>
    from tkCommonDialog import Dialog
  File "/usr/lib/python2.7/lib-tk/tkCommonDialog.py", line 11, in <module>
    from Tkinter import *
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 42, in <module>
    raise ImportError, str(msg) + ', please install the python-tk package'
ImportError: No module named _tkinter, please install the python-tk package

Obviously pulling in apt-get install python-tk will also pull x11 which is a quite hefty requirement for a headless server and a command line daemon.

Basically the error message is quite misleading.

Apparently adding the -m parameter removes the python-tk requirement but halts at

7DTD-leaflet-1.0# python map_reader.py -m "/home/sdtd/instances/One/Random Gen/One/Player"

Usage:
 -m "C:\Users..":        The folder that contain .map files
 -t "tiles":             The folder that will contain tiles (Optional)
 -z 8:                           Zoom level 4-n. Number of tiles to extract around position 0,0 of map. It is in the form of 4^n tiles.It will extract a grid of 2^n*16 tiles on each side.(Optional)

Where it just sits and waits for keypress after which it returns to command prompt.

So it looks like there is a typo at

        for opt, value in getopt.getopt(sys.argv[1:], "g:")[0]:
            if opt == "-g":

which should be

        for opt, value in getopt.getopt(sys.argv[1:], "m:")[0]:
            if opt == "-m":

after which it works.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.