Wiki » Historial » Versió 1
Eloi Rebes, 23-07-2015 09:22
1 | 1 | Eloi Rebes | Usage |
---|---|---|---|
2 | 1 | Eloi Rebes | Parsing |
3 | 1 | Eloi Rebes | |
4 | 1 | Eloi Rebes | You can download data.pak from here and skip to the next section. (there's no guarantee that the data will be up-to-date, however) |
5 | 1 | Eloi Rebes | |
6 | 1 | Eloi Rebes | First, you need to download the following input data: |
7 | 1 | Eloi Rebes | |
8 | 1 | Eloi Rebes | * CNML export of the "World" zone, at the "Zones and Nodes" level: http://guifi.net/snpservices/data/guifi.cnml |
9 | 1 | Eloi Rebes | |
10 | 1 | Eloi Rebes | * GML export of the "World" zone, of the links: http://guifi.net/guifi/gml/3671/links |
11 | 1 | Eloi Rebes | |
12 | 1 | Eloi Rebes | As of v0.2.0, you can dump individual zones other than World, allowing you to quickly see your zone's changes with a partial KML. Just make sure the CNML and the GML are of the same zone! |
13 | 1 | Eloi Rebes | |
14 | 1 | Eloi Rebes | Now you can parse those two files into an efficient MSGPack archive: |
15 | 1 | Eloi Rebes | |
16 | 1 | Eloi Rebes | <pre> |
17 | 1 | Eloi Rebes | # Replace `nodes.cnml` and `links.gml` with the files you downloaded |
18 | 1 | Eloi Rebes | $ ./compile.coffee nodes.cnml links.gml > data.pak |
19 | 1 | Eloi Rebes | </pre> |
20 | 1 | Eloi Rebes | |
21 | 1 | Eloi Rebes | Now you can remove the original XML files, they are no longer needed. |
22 | 1 | Eloi Rebes | Converting |
23 | 1 | Eloi Rebes | |
24 | 1 | Eloi Rebes | To produce the final KML, just do: |
25 | 1 | Eloi Rebes | |
26 | 1 | Eloi Rebes | <pre> |
27 | 1 | Eloi Rebes | # Adjust `data.pak` if you have downloaded it somewhere else. |
28 | 1 | Eloi Rebes | $ ./compile.coffee data.pak > guifi.kml |
29 | 1 | Eloi Rebes | </pre> |
30 | 1 | Eloi Rebes | |
31 | 1 | Eloi Rebes | The output will be stored in guifi.kml. Just open it in Google Earth. |
32 | 1 | Eloi Rebes | |
33 | 1 | Eloi Rebes | Tip: you may want to keep or distribute data.pak to experiment with your own KMLs. Keep reading. |
34 | 1 | Eloi Rebes | Tweaking |
35 | 1 | Eloi Rebes | |
36 | 1 | Eloi Rebes | Want to customize your KML a bit? No worries, it's simple and straightforward. |
37 | 1 | Eloi Rebes | |
38 | 1 | Eloi Rebes | The model folder contains the files which are used to produce the KML. It can be intimidating at first, and you should learn the basics of KML and Jade to do more things. There are four templates: |
39 | 1 | Eloi Rebes | |
40 | 1 | Eloi Rebes | * root.jade: It produces the "root" folder, the one which gets added when you open the KML. You normally don't want to modify this. |
41 | 1 | Eloi Rebes | * zone.jade: It produces every zone folder and sorts his contents (to put supernodes first, and other nodes later). You normally don't want to modify this. |
42 | 1 | Eloi Rebes | * node.jade: It produces every node placemark. It styles that placemark (icon, color, description) according to the node's properties. |
43 | 1 | Eloi Rebes | * links.jade: It produces a folder, and puts lines representing links inside of that folder. |
44 | 1 | Eloi Rebes | |
45 | 1 | Eloi Rebes | Take the appropiate one depending on what you want to customize, open it in the editor and play with it. There are some annotations to guide you (lines that start with // or //-). |
46 | 1 | Eloi Rebes | |
47 | 1 | Eloi Rebes | Once you have made some modifications, just call compile.coffee again. And if you made a nice change, I encourage you to contribute it so everyone can have it too. :) |
48 | 1 | Eloi Rebes | Implementation |
49 | 1 | Eloi Rebes | |
50 | 1 | Eloi Rebes | The two-step process is done to keep the processing operation fast, so you can hack on the template and see your changes quickly. It also makes it easier for others to build their own KML; just give them the data.pak which is a lot smaller than its respective XML files. |