O'Reilly logo

Python Geospatial Development - Second Edition by Erik Westra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Editing features

Now that we know which feature the user wants to edit, our next task is to implement the edit feature page itself. To do this, we are going to have to create a custom form with a single input field, named geometry, that uses a map-editing widget for editing the feature's geometry.

To create this form, we're going to borrow elements from GeoDjango's built-in "admin" interface, in particular the django.contrib.gis.admin.GeoModelAdmin class. This class provides a method named get_map_widget() which returns an editing widget which we can then include in a custom-generated form.

The process of building this form is a bit involved, thanks to the fact that we have to create a new django.forms.Form subclass on-the-fly to be handle the different ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required