scribe - mapgears.com€¦ · scribe howto: comments sometimes it's useful to simply comment...

33
Scribe MapServer Mapfile Development Made Easy Julien-Samuel Lacroix Mapgears @juliensam

Upload: others

Post on 20-Aug-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

ScribeMapServer Mapfile Development

Made Easy

Julien-Samuel LacroixMapgears

@juliensam

Page 2: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

Mapfile development

➔ Mapfile are great and powerful➔ It's possible to get beautiful results➔ Mapfile are human readable➔ We have script to generate mapfiles➔ Big mapfile can use INCLUDE

Page 3: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

Mapfile development

Everyone that has develop big mapfile has gone through a variety of issues:

➔ A lot of copy paste➔ Multiple data source for the same layer➔ A lot of copy paste➔ Scales are a little bit confusing➔ A lot of copy paste➔ No variables➔ And so on...

Page 4: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

Mapfile development

Multiple windows at once:

➔ Text editor➔ Browser with mode=browse&template=openlayers➔ Console for the debug output➔ File browser➔ SQL window➔ QGIS for attributes➔ ogrinfo / gdalinfo

Page 5: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

The goal is to make our life simple

➔ The Scribe syntax➔ ScribeUI➔ Tips and tricks

ScribeUI is there to make things easier for mapfile developper

By mapfile developper!

Page 6: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

Scribe syntax

Alternative syntax like:● XML Mapfile● Basemaps● In-house format

Still based on the Mapfile syntax

Python script that output a regular mapfile

Page 7: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

Scribe syntax

It's a way to make mapfile development more productive by removing a lot of copy/pasting.

It makes project more manageable

It does save a lot of time when developping mapfiles.

Page 8: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

Some Scribe syntax details

● Creates multiple layers, one for each scale● Result is perfectly indented● Prevent layer duplication for the developper● Still based on the Mapfile syntax not a

replacement.

As simple as:$ python scribe.py

Page 9: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

Scribe Howto: Scales

Definition of scalesSCALES {

   1:268435456

   2:134217728

   ...

   16:8192

}

From here, no more:

MINSCALEDENOM MAXSCALEDENOM

Page 10: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

Scribe Howto: Scales

LAYER {

    1­16 {

        NAME: 'ocean'

        TYPE: POLYGON

        @layerconfig

        DATA {

            1­5: '110m_physical/ne_110m_ocean'

            6­10: '50m_physical/ne_50m_ocean'

            11­16: '10m_physical/ne_10m_ocean'

        }

        CLASS {

            STYLE {

                COLOR: '#C6E2F2'

            }

        }

    }

}

Page 11: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

Scribe Howto: Scales

STYLE {

    COLOR: '#aaaaaa'

    WIDTH {

      12: 0.5

      13: 1

      14: 2

      15­16: 4

    }

}

Page 12: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

Scribe Howto: Variables

VARIABLES {

    layerconfig {

        GROUP: 'default'

        STATUS: ON

        PROCESSING: 'LABEL_NO_CLIP=ON'

        PROCESSING: 'CLOSE_CONNECTION=DEFER'

    }

    land_ol_width: 1

}

From here:

LAYER {

    NAME: 'ocean'

    @layerconfig

    ...

        WIDTH @land_ol_width

Page 13: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

Scribe Howto: Comments

Sometimes it's useful to simply comment out,

Sometimes it's useful to leave a note or explanation:

##Comments preceded with ## appear

##in the resulting mapfile.

##Comment blocks between /* */

## do not appear in the resulting mapfile.

/* 

OUTLINECOLOR: 200 200 200

OUTLINEWIDTH: @land_ol_width

*/ 

Page 14: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

Scribe

Use it! 

Page 15: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

ScribeUI

➔ Mapfile editor➔ Productivity tool➔ Get everything in the same place

Page 16: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

ScribeUI: Take a tour (Basics)

➔ WorkspaceProject, may be password protected

➔ New Map TemplateYou can use any existing map as a template

➔ EditorEdit layers per group

➔ Layer groupsAdd groups and modify their order

➔ MAP definitionKeep it at hand

➔ See your changes live

Page 17: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

ScribeUI: Workspace

It's a project

May be password protected

Can contain multiple map

Page 18: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

ScribeUI: New Map Template

Creating a new map is as easy as a copy/paste

You can duplicate any existing map in any workspace

Page 19: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

ScribeUI: Editor

Grouped by layer group

Color coded

Line number

Page 20: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

ScribeUI: Layer Groups

Add new layer group or delete existing ones

Modify the order of existing groups

Page 21: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

ScribeUI: Map Definition

Easy to access

Can hide it

Page 22: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

ScribeUI: Take a tour (Developpers)

➔ DebugSee the logs as you navigate the map

➔ ResultSave the mapfile or link directly to the tiles

➔ Point of InterestQuickly zoom to your area of interest

➔ Browse tabUpload or download data file

➔ In the cloudStop copying the data files on all developper's computers

Also allow multiple people to work on the same project together

Page 23: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

ScribeUI: Debug

See what's happening in real time

Pan the map to get debug info

Page 24: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

ScribeUI: Result

Save the resulting mapfile

It's also possible to export the project

Page 25: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

ScribeUI: Point of Interest

Quickly access your area of interest

Make it easy to test several region when editing style

Page 26: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

ScribeUI: In the cloud

● It allows a group of developpers to work together without duplicating the data.

● Password protect each projects● Work on a centralized system● No more multiple installation puzzle● Upload your data directly from the web

interface

Page 27: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

ScribeUI: Browse Tab

Upload new data file

Download data or files available on the server

Page 28: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

Plugins!

ScribeUI supports plugins. You can add your own tool by simply creating a directory in:

application/plugins/

In the UI, work with the Dom:➔ addButton()➔ addTab()

On the server:

Plugins get their custom route

Page 29: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

Plugins: example

SetExtent is an example plugin that allow you to redefine the map extent with some map interaction.

Refer to the code for

plugin development

references.

Page 30: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

Plugins to come...?

➔ Color swatch➔ MapCache configuration➔ Precache jobs➔ Git integration➔ Data visualisation➔ Human readable debug output➔ Sky is the limit

Page 31: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

Tips and tricks

➔ You can now think of your maps as levels instead of monolithic services.

➔ Scribe allow you to consider the map with cartographer's, or designer, eyes instead of from application developper constraint.

➔ Variables are the best thing.➔ ScribeUI Logs tell you where are your scribe

syntax errors➔ POIs are your friend

Page 32: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

Demo!If time permits...

Page 33: Scribe - mapgears.com€¦ · Scribe Howto: Comments Sometimes it's useful to simply comment out, Sometimes it's useful to leave a note or explanation: ##Comments preceded with ##

Questions?Thank you!

Julien-Samuel LacroixMapgears

@juliensam