Skip to main content

Map features

The geo-fields, enable the user to define geo-objects on a MapView.

Draw a point

The GeoPointField enables the user to draw a point on the map, which is returned in the params as a GeoPoint:

from viktor.parametrization import ViktorParametrization, GeoPointField


class Parametrization(ViktorParametrization):
geo_point = GeoPointField('Draw a point')

Draw a polyline

The GeoPolylineField enables the user to draw a polyline on the map, which is returned in the params as a GeoPolyline:

from viktor.parametrization import ViktorParametrization, GeoPolylineField


class Parametrization(ViktorParametrization):
geo_polyline = GeoPolylineField('Draw a polyline')

Draw a polygon

The GeoPolygonField enables the user to draw a polygon on the map, which is returned in the params as a GeoPolygon:

from viktor.parametrization import ViktorParametrization, GeoPolygonField


class Parametrization(ViktorParametrization):
geo_polygon = GeoPolygonField('Draw a polygon')

Visualize geo-objects on the map

The above geo-fields let the user 'draw' geo-objects, but does not actually visualize it on the map. If visualizing the geo-objects on the map is desired, this can easily be achieved by making use of the class-method on the corresponding map feature as described here.

Interact with geo-objects on the map

In addition to visualizing geo-objects, it is also possible to let the user interact with the geo-objects on the map.