Create

Create a new portal

  1. Create at least a dist config file for the portal named config/dist/<portal>.dist.toml. You can view an example here.

  2. Create the map files: you must at least create a map file named customer-infra/portals/<portal>.in.map. This will be the main map file for the portal. You can use includes in this file and the jinja2 template language. To know more about that, referer to the template section of the infrastructure page.

  3. Create the translations CSV files below. All these files must have this header: key,fr,de,en,commentaires. The content of the commentaires column will be ignored. You can off course add/remove language columns. To learn more how translations work, see the section about translations from the portal configuration page.

    • customer-infra/translations/catalog.csv: the content of the catalog, common to all portals. This includes the layer names present in the catalog and the title of the section of the catalog.
    • customer-infra/translations/<portal-name>.csv: everything else (note: the translation for the topic titles and the topic tooltip – topic_<topic_name>_tooltip – go here).
    • customer-infra/translations/common.csv (optional): if you find redundancies between the translations for different portals, you can put them in this file. It will be loaded before the file for the portal, which means, you can override a translation from this file in a portal file.

    Attention

    At least one of the files above must contain a translation line. Otherwise, no layers config will be created. Which means your portal won’t work.

  4. Add the external layers (WMS or WMTS) by creating the relevant JSON files in customer-infra/json/<portal>/external (optional). To learn more about how to write these files, refer to the proper section of the page about portal configuration. You can view examples here.

  5. Create the JSON topic files in customer-infra/json/<portal>/topics. They define for each topic its name, languages, background layers, selected layers and catalog. You can view examples here. To learn more how topics work, see the section about topics from the portal configuration page.

  6. Add the logo used in your print templates in customer-infra/print/<portal>/. See the print section of the portal configuration page to learn more about printing. This folder must contain:

    • NorthArrow.svg if your templates have the north arrow.
    • Any logo used in your print templates.
  7. Add the images for a portal in customer-infra/img/<portal-name>/. It must contain:

    • The favicon in favicon.ico.
    • A JPEG file per topic. These files are named like this: <my_topic>.jpg.
    • A logo per language. They are named like this: logo.ch.<lang>.png.
  8. Prepare the help site (optional). General steps are detailed below. To learn more about help, look at the section about help in the portal configuration page.

    • Put any texts and images that are common to all portal in the customer-infra/help/common folder. Everything that is in this folder will be loaded before any portal data, which means you can override any value in the portal folder.
    • Put any texts and images specific to a portal in customer-infra/help/<portal>/.
  9. Enable searches in search.locations. This key must contain the list of the names of the locations indexes that must be enabled for this portal. For instance:

    [search]
    locations = ['places']
    

Create a new infrastructure

You should use this git repository as a template.

  1. Create the config/config.dist.sh file with the values for deployment. You can view an example here.

  2. Create the config/dist/_common.dist.toml which will hold all values shared between portals. You can view an example here.

  3. Prepare the config/_template.dist.toml file that will be used to validate the configuration files for each portals. It must contain the key that are allowed in each portal config file. You can view an example here.

  4. Create the search templates for portal: customer-infra/search/portal-locations.in.conf. Here is an example:

    source src_{{ geoportal.name }}_location : def_pgsql_{{ geoportal.name }}
    {
        sql_attr_uint = num
        sql_attr_uint = rank
        sql_attr_string = label
        sql_attr_string = origin
        sql_attr_string = geom_st_box2d
        sql_attr_float = x
        sql_attr_float = y
        sql_attr_float = lat
        sql_attr_float = lon
        sql_attr_bigint = weight
        sql_field_string = search_string
        sql_field_string = geom_quadindex
        sql_db = {{ mapserver.PORTAL_DB_NAME }}
    }
    
    {% for location in search.locations %}
    
    source src_{{ geoportal.name }}_{{ location }} : src_{{ geoportal.name }}_location
    {
        sql_query = \
            SELECT id \
            , remove_accents(name) as search_string \
            , name as label \
            , 'places' as origin \
            , geom_quadindex \
            , geom_st_box2d \
            , {{ search.origins_to_ranks[location] }} as rank \
            , x \
            , y \
            , lat \
            , lon \
            , osm_id as num \
            , row_number() OVER (ORDER BY name) AS weight \
            FROM osm.{{ location }} \
            WHERE name IS NOT NULL
    }
    
    index {{ geoportal.name }}_{{ location }}
    {
        type = plain
        docinfo = extern
        min_infix_len = 2
        source = src_{{ geoportal.name }}_{{ location }}
        path = /var/lib/sphinx/data/{{ search.customer }}/{{ geoportal.name }}_{{ location }}
    }
    
    
    {%- endfor %}
    
    
    index {{ geoportal.name }}_locations
    {
        type = distributed
        {%- for location in search.locations %}
        local = {{geoportal.name}}_{{location}}
        {%- endfor %}
        min_infix_len = 2
    }
    
  5. Configure your .gitignore to ignore user specific configuration files and generated output. You can view an example here.

  6. Prepare you print templates. You can view examples of them here. You can create your print templates with Jasper Studio or directly by editing the jrxml files with a text editor.

  7. Prepare the translations folder by creating the ignore.csv file. This file will just contain the translation ids (one per line) you don’t want included in JSON translation files. You probably want to exclude everything that deals with Swisstopo. You can view an example here.

  8. You can create a docs subdirectory and setup sphinx in it (see how it is done in the docs folder of geo-infra). You can then build this doc with manuel build-doc-customer.

  9. Create a new portal.