.. _vector-editing-introduction: Vector Editing Introduction ===================================================================== .. figure:: images/edit01_03.gif :alt: Vector Editing Animation Animation of Vector Editing The Vector Editing capabilities of GeoMoose allow your users to create, edit, and delete geometry and properties of point, line, and polygon vector features and save those edits on your server. To enable the editing of features, you must: #. Setup a WFS-T 1.1.0 compliant server such as GeoServer or TinyOWS #. Configure a map-source in your GeoMoose mapbook to enable the editing of the layer This is a basic walk-through to show how to configure GeoMOOSE to allow editing of features. It will cover two possible WFS-T server configurations: - :any:`geoserver+geopackage` - :any:`Mapserver's TinyOWS + PostGIS ` You will need only one of the two above configurations to experiment with editing vectors with GeoMoose. Other configurations are possible, such as GeoServer + PostGIS, but are not described here. .. _vector-editing-tutorial: Vector Editing Tutorial ===================================================================== Installing the Demo Data --------------------------------------------------------------------- GeoServer can use various databases to store data. The easiest to configure for the purpose of this demo is GeoPackage, a file-based relational database built on SQLite. - Download the latest release (v3.7 or greater) of the GeoMoose Demo data from `gm3-demo-data `__. - Unzip the data in a folder of your choice. .. _geoserver+geopackage: WFS-T Server: GeoServer + GeoPackage --------------------------------------------------------------------- These instructions are for GeoServer 2.17.2, but later versions will work and the setup should be similar. The best documentation on installing and using GeoServer comes from `GeoServer `__ itself. Install GeoServer as per the instructions in the GeoServer documentation, and startup a GeoServer instance by executing ``Geoserver\bin\startup.sh.`` If you've installed GeoServer on Windows, start GeoServer by executing ``C:\Program Files\GeoServer\bin\startup.bat``, and make sure you run startup.bat with **Administrator** privileges. Now open a browser and go to http://localhost:8080/geoserver/web/. Login to GeoServer by using the default credentials: username ``admin``, password ``geoserver``. Configuring GeoServer to Use census.gpkg ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Note the location of the ``census.gpkg`` file. It will be in the ``gm3-demo-data/demo/census/`` folder. Add a New Workspace #. In the left control-panel column of GeoServer, under the "Data" header, click on "Workspaces". #. Click the green "+" button. #. Name the work space ``Geomoose`` with a Namespace URI of ``http://geomoose.demo``. Add a New Data Store #. In the left control-panel column of GeoServer, under the "Data" header, click on "Stores". #. Click the green "+" button to create a new data store. #. On the New data source page, click on "GeoPackage" #. Use the following settings: - Workspace: Geomoose - Data Source Name: census_data - Description: Census Data for Demo - Enabled: Should be checked to indicate "true". - The rest of the settings are for PostgreSQL, please fill them out to match the information you used to load the shapefile. Add New Layers - publish Enable CORS (if necessary) .. _tinyows+postgis: WFS-T Server: TinyOWS + PostGIS --------------------------------------------------------------------- Install Mapserver's TinyOWS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Install PostGIS and Load the Places Shapefile ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Install PostGreSQL. Install `PostGIS `__. Create a user ``gis`` with a password of ``super_gis``, create a database named ``gis2`` and grant all privileges to user ``gis``\ to the ``gis2`` database. Now load the Places shapefile. There are a couple of good applications for doing this, GDAL's ``ogr2ogr`` and PostGIS'\ ``shp2pgsql``. Whichever tool you use, the layer should be named ``census_cities`` for the purposes of this example. A typical ``ogr2ogr`` string to load the data will look similar to this: :: ogr2ogr -f PostgreSQL "PG:dbname=gis2 user=gis password=super_gis" tl_2019_27_place.shp tl_2019_27_place -nln census_cities -nlt GEOMETRY -lco DIM=2 The commands for the other two point and line shapefiles would be: :: ogr2ogr -f PostgreSQL "PG:dbname=gis2 user=gis password=super_gis" tl_2019_27_pointlm.shp tl_2019_27_pointlm -nln census_landmarks -nlt GEOMETRY -lco DIM=2 ogr2ogr -f PostgreSQL "PG:dbname=gis2 user=gis password=super_gis" tl_2019_27_prisecroads.shp tl_2019_27_prisecroads -nln census_roads -nlt GEOMETRY -lco DIM=2 Configure TinyOWS by replacing the content of TinyOWS config.xml with: .. code:: xml To display the vectors, create a Mapserver map file: .. code:: MAP INCLUDE '../../geomoose_globals.map' DEBUG 5 WEB METADATA 'ows_title' 'GeoMoose Example Census data' INCLUDE '../../common_metadata.map' 'wfs_getfeature_formatlist' 'gml,geojson' END END LEGEND STATUS ON KEYSIZE 18 12 # LABEL object # LABEL # TYPE BITMAP # SIZE MEDIUM # COLOR 0 0 89 # END END LAYER NAME census_cities STATUS ON DUMP TRUE METADATA 'ows_title' 'Cities' 'ows_include_items' 'all' 'gml_include_items' 'all' END CONNECTIONTYPE POSTGIS CONNECTION "host=localhost dbname=gis2 user=postgres password=postgres" DATA "wkb_geometry from census_cities" TYPE POLYGON PROJECTION 'init=epsg:4269' END LABELCACHE ON # LABELMAXSCALE 20000 CLASS NAME 'Cities' STYLE WIDTH 3 COLOR 180 180 254 OUTLINECOLOR 0 0 0 OPACITY 50 END LABEL TEXT "[name]" TYPE TRUETYPE FONT vera_sans SIZE 20 ANTIALIAS TRUE COLOR 0 0 0 OUTLINECOLOR 254 254 200 BUFFER 4 MINFEATURESIZE auto PARTIALS FALSE POSITION cc END END TEMPLATE 'dummy' END END ## end Map Edit the GeoMoose mapbook.xml to include: .. code:: xml http://localhost/cgi-bin/tinyows.exe ./demo/census/census.map