class onegov.gis.models.Coordinates(lat=None, lon=None, zoom=None)[source]

Represents a pair of coordinates.

May contain zoom factor and other information like marker icon and color. Note that only latitude and longitude really matter, the rest may or may not be used.

class onegov.gis.models.CoordinatesMixin[source]

Extends any class that has a content dictionary field with a single coordinates pair.


class onegov.gis.forms.CoordinatesField(*args, **kwargs)[source]

Represents a single pair of coordinates with optional zoom and marker icon/color selection.

In the browser and during transit the point is stored as a base64 encoded json string on a simple input field. For example:

eydsYXQnOiA4LjMwNTc2ODY5MTczODc5LCAnbG.. (and so on)


{'lon': 8.30576869173879, 'lat': 47.05183585, 'zoom': 10}

For verification: This points to the Seantis office in Lucerne.

For convenience, the coordinates are accessible with the onegov.gis.models.coordinates.Coordinates class when ‘data’ is used.

Note that this field doesn’t work with the InputRequired validator. Instead the DataRequired validator has to be chosen.


Process the Python data applied to this field and store the result.

This will be called during form construction by the form’s kwargs or obj argument.


value – The python object containing the value to process.

populate_obj(obj, name)[source]

Populates obj.<name> with the field’s data.


This is a destructive operation. If obj.<name> already exists, it will be overridden. Use with caution.


Process data received over the wire from a form.

This will be called during form construction with data supplied through the formdata argument.


valuelist – A list of strings to process.

class onegov.gis.forms.CoordinatesWidget(input_type=None)[source]

Widget holding and showing the data behind the onegov.gis.forms.fields.CoordinatesField class.

Basically a textfield that stores json. Meant to be enhanced on the browser using javascript.


class onegov.gis.integration.MapboxApp[source]

Provides mapbox integration onegov.core.framework.Framework based applications.

Doesn’t do much except serve the mapbox public token, so we can store it in configuration and not with the source. Not that this token is inherently unsafe and must be the public token.

Do not use private tokens!

If we wanted to avoid this we would have to use a mapbox proxy server, which seems a bit too much. If we detect abuse of the public token we just switch to a new one. If it must be we can even automatically rotate the token regularly.


Configures the mapbox.

The following configuration options are accepted:


The public mapbox token to be used for the mapbox api.