Advanced digitizing

From MapbenderWiki

Jump to: navigation, search

Contents

Use Cases

  • Add an external feature for snapping only
  • Add an external feature and insert it into another WFS-T
  • Inserting or updating of multiple features in one transaction

Add external features

  • the digitizing module uses Mapbender's geometry objects GeometryArray, MultiGeometry and Geometry.
  • You can create a GeometryArray from a GeoJSON
var geom = new GeometryArray();
geom.importGeoJSON(geoJSON);
  • Then, you can pass it to the digitizing module (digitizeFrame is the name of the digitizing module, it's still an IFrame)
digitizeFrame.appendGeometryArray(geom);
  • depending on the attributes of the feature, the digitizing module behaves differently

Feature ID

  • The feature ID (FID) in GeoJSON
If a feature has a commonly used identifier, that identifier should be
included as a member of the feature object with the name "id".

(see http://geojson.org/geojson-spec.html#id21)
  • In Mapbender's GeometryArray, the FID is a property of a Multigeometry. Properties are represented in the attribute .e of a MultiGeometry. See the contructor WFS_Element in geometry.js for further details
  • you can configure this behaviour in the digitizing configuration file (default: conf/digitize_default.conf) by setting featuresMustHaveUniqueId to true
  • If the feature already has an FID, it may not be stored into other WFS-T. If you want to enable this behaviour, remove the feature ID in the GeoJSON
delete geoJson.features[0].id

or in the MultiGeometry iof a GeometryArray

geom.get(i).e.delElement("fid");

WFS Conf

  • The WFS Confs are loaded via mod_wfs_conf. This module produces an array of objects. The indices of the array are the JS WFS Conf IDs. Each object has an attribute .wfs_conf_id, which is the DB WFS Conf ID.
  • A MultiGeometry object has the attribute .wfs_conf. It's the JS WFS Conf ID.
  • You need to set the correct JS WFS Conf ID on your MultiGeometry. Find the JS WFS Conf ID like this
digitizeFrame.getJsWfsConfIdByDbWfsConfId(wfsConf, dbWfsConfId)

You can get the wfsConf object from mod_wfs_conf with the global function

get_complete_wfs_conf();
  • If the WFS of the feature's WFS Conf is non-transactional, the feature will not appear in the feature list, but it will be available for snapping. A workaround is to empty the WFS' transactional URL field in the entry in the WFS table
Views
Personal tools