Skip to content
Juan Gallostra edited this page May 20, 2020 · 2 revisions

Adding a new Zone

The sections below outline how new zone data should be added to the project.

Folder Structure

To create a new zone and its sectors:

  1. Create a new folder inside data/zones with the name of the zone (data/zones/NEW_ZONE_NAME).
  2. Inside this new folder data/zones/NEW_ZONE_NAME create a NEW_ZONE_NAME.txt.
  3. If the zone has sectors (which is not mandatory) and you want to add its geographical area (again, not mandatory), create a new folder inside data/zones/NEW_ZONE_NAME and name it sectors (data/zones/NEW_ZONE_NAME/sectors).
  4. For each sector, create a SECTOR_NAME.txt inside the sectors folder.

Taking the previous points into account, the final zone structure should be:

data/zones
       |
       --- NEW_ZONE_NAME
                |
                --- NEW_ZONE_NAME.txt
                |
                --- sectors (optional)
                      |
                      --- SECTOR_NAME_1.txt (optional)
                      |
                      --- SECTOR_NAME_2.txt (optional)

Zone Data

The data for each zone and sector is stored in a txt file in JSON format. Its different fields and the general format are shown below.

{
    "name":"",
    "latitude":0,
    "longitude":0,
    "zoom":0,
    "parkings": [
        {
	    	"parking_latitude":0,
	    	"parking_longitude":0
        }
    ],
    "sectors": [
        {
            "name":"",
            "sector_data":"",
            "link":""
        }
    ],
    "guides":[
        {
            "name":"",
            "link":""
        }
    ],
    "playlist":"",
    "approximation": ""
}

Where each of the fields is:

Main fields

  • name:
    • Type: string
    • Description: Name of the zone. This is the name that will be shown for the zone.
  • latitude:
    • Type: float
    • Description: Latitude of the zone. This will be used to center the map.
  • longitude:
    • Type: float
    • Description: Longitude of the zone. This will be used to center the map.
  • zoom:
    • Type: integer
    • Description: Initial zoom of the zone map. Its value normally is 14, 15 or 16.
  • parkings:
    • Type: list of parking coordinates.
    • Description: Locations (latitude and longitude) of each of the parkings.
  • sectors:
    • Type: list of zone sectors.
    • Description: List of all the sectors in the zone.
  • guides:
    • Type: list of zone guides.
    • Description: List of zone guides.
  • playlist:
    • Type: string
    • Description: YouTube's id of the zone playlist.
  • approximation: Optional
    • Type: string
    • Description: Path to the GPX file with the approximation data.

Subfields

In each of the main fields, there can be as many of these subfields as required.

  • Parking coordinates

    • parking_latitude: float, the latitude of the parking in order to place the marker.
    • parking_longitude: float, the longitude of the parking in order to place the marker.
  • Sector

    • name: string, the name that will be shown for the sector.
    • sector_data: string, the path to the sector data. It is /sectors/SECTOR_NAME.txt.
    • link: string, the full link to the sector's playlist.
  • Guide

    • name: string, the name of the Guide that will be shown.
    • link: string, the full link to the Guide's webpage.

Update zone's list and generate zone map and page

Finally, to generate the pages of the new zone so that they are listed in the webpage:

  1. Run $ python generate_templates.py to add the new zone to the general zone's map and to create the new zone's map.
  2. Run $ python generate_pages.py to generate the page of the new zone
  3. Add a link to the new zone in the file zones_list.html. The entry should look like*:
<p>&bull;<a href="/NEW_ZONE_NAME"> Zone Name</a></p>
  1. Create a PR for the new/updated data to be added.

(*) If the zone is in a country not listed yet, a new entry for the country should be added to the list. The html should then look like:

<h2>{{ _("Country Name") }}</h2>
<br />
<p>&bull;<a href="/NEW_ZONE_NAME"> Zone Name</a></p>
<hr />
<br />

Development

Environment Setup

Adding Areas and Sectors

New Zone

New Sector

Extras

Translations

Clone this wiki locally