670 likes | 818 Views
Constraints in geo-information models and their implementations in systems. Peter van Oosterom GIS technology, OTB. Contents. Introduction Constraints in a landscape design VR system Constraints in a cadastral data set (topology) Constraints in a topographic base data set
E N D
Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB
Contents • Introduction • Constraints in a landscape design VR system • Constraints in a cadastral data set (topology) • Constraints in a topographic base data set • Constraints in web feature service transactions • Classification of constraints • Support for constraints • Conclusions and further research
IntroductionGeo-information models • OMG’s Model Driven Architecture (MDA): the model forms the foundation for further system development • The data aspect of the model is often described in a UML class diagram (Unified Modeling Language), which defines for a class: • Attributes (names and types) • Methods • Associations (generalization, aggregation) • However, often constraints are ignored
IntroductionConstraints • Constraints are conditions, which always have to be fulfilled by the user and/or by the data processing operators of the system • Constraints can be related to properties of the object itself and/or to relationships between the objects Example:Tree must never stand in the water
Introduction • More attention for constraints needed as they add meaning/semantics to the model • Constraints enable further consistency checking • Constraints should be explicitly modeled, specified once and used throughout system: • Create/edit objects (in GIS/CAD editor) • Storage/manage objects (in geo-DBMS) • Exchange objects (in communication, XML)
Contents • Introduction • Constraints in a landscape design VR system • Constraints in a cadastral data set (topology) • Constraints in a topographic base data set • Constraints in web feature service transactions • Classification of constraints • Support for constraints • Conclusions and further research
The SALIX-2 system • Landscape architectural design • Interactive planting trees, bushes • Growing simulation Constraints to improve the interactivity! Originally developed by Wageningen University Adding constraints: MSc-thesis project of Jildou Louwsma
Three classes objects: trees, bushes and ground surface Trees and bushes: CorAve, CorMAs, FraxExc, QueRob, RosCAn Ground surface: water, paving, grass and bridge. UML class diagram for SALIX-2
Constraints in SALIX-2 (1) • Direction:A bush always has to placed south of a tree • Topology: Bushes always have to be disjoint or meet water; A bush always has to meet or be disjoint paved areas (also thematic constraint) • Metric: Trees always have to be positioned > 1 meter from paving • Temporal: An oak always grows for 70 years • Quantity: There must always be at least 10 trees on the specified ground surface
Constraints in SALIX-2 (2) • Thematic: A bush always has to meet or be disjoint paved areas (also topological constraint) • Complex: The distance between trees inside water always is > 8 m AND the distance between the tree and the edge of the water always has to be < 0,5 meter AND the species must be a salix;Trees of type 1 always have to be placed west of trees of type 2 AND the distance between trees of type 1 and trees of type 2 must always be 7 meters (pattern)
All SALIX-2 constraints specified as assertions (SQL92 standard) CREATE ASSERTION <assertion_name> CHECK <constraint_body> Bushes never lie inside water: create assertion constraint_1 check (not exists ( select * from prcv_treesrd_point t, prcv_gvkrd_poly g where t.treetype in (‘CorAve’, ‘CorMas’, ‘RosCan’) AND g.descript = ‘water’ AND sdo_relate (g.geom., t.geom., ‘mask=inside, querytype=window’) =’TRUE’)) However, not available in any mainstream DBMS
SALIX-2 constraints hand-coded in Oracle Triggers/Procedures CREATE OR REPLACE TRIGGER ast_salix AFTER INSERT ON prcv_treesrd_point BEGIN -- constraint 1: a bush must never be placed inside water the existing -- table with all objects has no bushes inside the water, so only -- after each update or insert a check has to take place if -- the new location of a bush is inside water. This can be -- an after statement trigger. IF pck_salix.treetype_io IN ('CorMas', 'RosCan', 'CorAve') THEN -- the object is a bush, so all constraints concerning -- bushes must be run. DBMS_OUTPUT.PUT_LINE('the involved object is a bush'); pck_salix.pr_topology_c1; ELSE raise_application_error(-20099,'the object is a tree, no constraints have to be checked.'); END IF; END;
Triggers/Procedures in SALIX-2 PROCEDURE pr_topology_c1 IS description varchar2(15); xrd_io number; yrd_io number; bush_in_water EXCEPTION; BEGIN SELECT g.descript, t.geom.sdo_point.x, t.geom.sdo_point.y INTO description, xrd_io, yrd_io FROM prcv_gvkrd_poly g, prcv_treesrd_point t WHERE t.treeid = pck_salix.treeid_io AND sdo_relate(g.geom, t.geom, 'mask=anyinteract, querytype=window') ='TRUE' GROUP BY g.descript, t.geom.sdo_point.x, t.geom.sdo_point.y; IF description = 'water' THEN raise bush_in_water; ELSE DBMS_OUTPUT.PUT_LINE('1: the bush is not placed in water'); END IF; EXCEPTION WHEN bush_in_water THEN raise_application_error (-20001, '1: The bush (x='||to_char(xrd_io)||', y='||to_char(yrd_io)||') is placed inside water, but a bush may never be placed in water. Place the bush on another location.') END pr_topology_cl;
Some lessons, VR landscape design • Constraints occurs at different places: VR user interface and data storage • When designing: immediate feedback to user is important • DBMS support of assertions is non existent! • Simulation adds an other ‘dimension’ to constraints: when creating an initial plantation layout everything may be correct, but after 5 years of simulated growth there may be conflicts; trees get too close
Contents • Introduction • Constraints in a landscape design VR system • Constraints in a cadastral data set (topology) • Constraints in a topographic base data set • Constraints in web feature service transactions • Classification of constraints • Support for constraints • Conclusions and further research
Netherlands Cadastral map (1:1000) • Based on winged edge topology stored in DBMS • Redundancy in references; e.g. both object_id left/right and parcel_number left/right • Considered as a topological very clean data set • Hard coded topology checks build in editor and check-in software; at DBMS server sided, but not in DBMS • Data set with history 1997-2004: • Boundaries/polylines: total 67.000.000 (22.000.000) • Parcels/faces: total 28.000.000 (7.000.000 actual)
ll_line_id l_obj_id lr_line_id fl_line_id r_obj_id fr_line_id Topology references
Spatial types, topology references(boundary: polyline, or circular arc)
Some, of the about 50, constraints (‘create assertion’ part skipped) • find closed ‘arcs’ (circles not allowed, not l/r side)SELECT object_id, numpoints(shape), anypoint(shape, 1), anypoint(shape, 2), anypoint(shape, 3)FROM xfio_boundary WHEREnumpoints(shape)=3 and interp_cd=3 and tmax = 0 and ogroup = 6 and(anypoint(shape, 1) = anypoint(shape, 3)); • find straight ‘arcs’ • parcel reference point not in bboxSELECT object_id from lki_parcel WHERE inside(location, geo_bbox) != 1;
Enlarged (cell=5mm) Closed ‘circular arc’ & geometric 1 mm gap
Enlarged (cell=5m) Straight line coded as circular arc
Topology reference exist • Boundary: left or right parcel obj_id does not existSELECT l_obj_idFROM lki_boundaryWHERE l_obj_id not in (select object_id from lki_parcel); • Boundary-boundary reference does not existSELECT object_id, fl_line_id FROM lki_boundary WHERE abs(fl_line_id) not in (select object_id from lki_boundary) • Parcel: outer boundary reference does not existSELECT object_id, line_id1 FROM lki_parcelWHERE abs(line_id1) not in (select object_id from lki_boundary); • Parcel: island boundary reference does not exist or wrong number of island references, l_num-1
Topology reference correct • Two consecutive boundaries must have same parcels at the side; 8 combinationsSELECT s.object_id, s.fl_line_idFROM xfio_boundary s, xfio_boundary rWHERE s.fl_line_id > 0 and s.fl_line_id=r.object_id ands.tmax=0 and s.ogroup=6 and r.tmax=0 and r.ogroup=6 ands.r_obj_id <> r.l_obj_id; • End point of one boundary is start of next; 8 combSELECT s.object_id, s.fl_line_idFROM xfio_boundary s, xfio_boundary rWHERE s.fl_line_id > 0 and s.fl_line_id=r.object_id ands.tmax=0 and s.ogroup=6 and r.tmax=0 and r.ogroup=6 and(anypoint(s.shape, 1) <> anypoint(r.shape, 1)); • Check if island boundary has parcel at the right side, check if first coordinate of island is within bbox parcel
More consistency checks… • Boundary Parcel references not consistentSELECT s.object_id, s.line_id1FROM xfio_parcel s, xfio_boundary rWHERE s.line_id1 > 0 and s.line_id1=r.object_id and s.tmax=0 and s.ogroup=46 and r.tmax=0 and r.ogroup=6 and(s.object_id <> r.r_obj_id); • Redundant double references, via object_id and parcel_number, not consistent • Geometric/survey and admin/right/owners side of parcel not consistentSELECT count(*),municip FROM mo_objectWHERE pp_i_ltr='G' and x_akr_objectnummer not in (select x_akr_objectnummer from lki_parcel)GROUP BY municip;
Some lessons, cadastral data • Never trust on front-end and/or middle ware alone for consistency checking check within DBMS • Even if the errors may not be noticed in the production environment, they may be harmful in the environments of others; e.g. straight ‘circular arcs’ • Not yet all aspects checked; e.g. • time intervals of two consecutive versions of an object should touch • the complete domain is covered with parcels • at one moment in time no (straight line or circular arc) boundary may cross, only touch at end points is allowed
Contents • Introduction • Constraints in a landscape design VR system • Constraints in a cadastral data set (topology) • Constraints in a topographic base data set • Constraints in web feature service transactions • Classification of constraints • Support for constraints • Conclusions and further research
Designed with constraints included in one single source model • New topographic product TOP10NL (from 1 jan 2006) • New production system: from files to DBMS • New exchange format: GML3-based and NEN3610-v2 • Initially constraints designed for validating conversion • However, same constraints will be used during future production editing • Constraints specified in one source in own XML-format (by Vertis and Topographic Service)
Types of constraints (as defined by Vertis and Topographic Service) • Single entity, single attribute (thematic)0 < road.num_lanes <= 10 • Single entity, multiple attributes (thematic) road.A-number <> ‘’ then road.type=‘highway’ • Geometry (besides some general rules minimum length of line and minimum size of area)road.width_class ‘<2m’ then geometry is line else area • Topology (several subtypes: covering_without_gaps, no_overlap, coincide, …)road, water and terrain may not overlap at same height • Relationshipevery feature must have at least 1 specified source
XML encoding of domains, ex. 1range type (width of water) <Domein> <Naam>dWaterBreedte</Naam> <Registreren>J</Registreren> <Beschrijving>Breedte voor Waterdeel</Beschrijving> <Type>Range</Type> <DataType>int</DataType> <CodedValueData/> <RangeData> <Minimum>1</Minimum> <Maximum>500</Maximum> <Default>6</Default> </RangeData> <SplitRegel>Duplicate</SplitRegel> <MergeRegel>DefaultValue</MergeRegel> </Domein>
XML encoding of domains, ex. 2enumeration type (type of railroad) <Domein> <Naam>dSpoorTypering</Naam> <Registreren>J</Registreren> <Beschrijving>Typeringen voor Spoorbaandeel</Beschrijving> <Type>CodedValue</Type> <DataType>int</DataType> <CodedValueData> <Code>44</Code> <Value>verbinding</Value> <Default>J</Default> </CodedValueData> <CodedValueData> <Code>45</Code> <Value>kruising</Value> <Default>N</Default> </CodedValueData> <RangeData> <Minimum/> <Maximum/> <Default/> </RangeData> <SplitRegel>Duplicate</SplitRegel> <MergeRegel>DefaultValue</MergeRegel> </Domein>
Single entity, multiple attributesconstraint ‘att007a’ <AttribuutRegel> <Nummer>att007a</Nummer> <VervolgNummer/> <Categorie/> <Beschrijving>Als Naam_Aweg is ingevuld, dan WegType moet 'autosnelweg' bevatten</Beschrijving> <FoutMelding>WegType bevat niet autosnelweg</FoutMelding> <TriggerNiveau>1</TriggerNiveau> <VervolgOperator/> <FeatureKlasse>EDT_WEG_VLAK</FeatureKlasse> <AlsAttribuut>NAAM_AWEG</AlsAttribuut> <AlsOperator>!=</AlsOperator> <AlsWaarde>""</AlsWaarde> <DanAttribuut>WEGTYPE</DanAttribuut> <DanOperator>MVCONTAINS</DanOperator> <DanWaarde>|autosnelweg|</DanWaarde> </AttribuutRegel>
Topology constraint ‘top04’ <AttribuutRegel> <Nummer>top04</Nummer> <VervolgNummer/> <Categorie/> <Beschrijving>Indien Wegvlak overlapt met Wegvlak dan moet HOOGTENIVEAU verschillend zijn</Beschrijving> <FoutMelding>Wegvlak overlapt Wegvlak</FoutMelding> <TriggerNiveau>1</TriggerNiveau> <VervolgOperator/> <FeatureKlasse>EDT_WEG_VLAK</FeatureKlasse> <AlsAttribuut>OBJECTID</AlsAttribuut> <AlsOperator>AREAOVERLAPAREA</AlsOperator> <AlsWaarde>EDT_WEG_VLAK</AlsWaarde> <DanAttribuut>HOOGTENIVEAU</DanAttribuut> <DanOperator>!=</DanOperator> <DanWaarde>FEATURE2.HOOGTENIVEAU</DanWaarde> </AttribuutRegel>
Relationship (count)constraint ‘brn01’ <AttribuutRegel> <Nummer>brn01</Nummer> <VervolgNummer/> <Categorie/> <Beschrijving>Iedere feature moet een Bron hebben</Beschrijving> <FoutMelding>Geen Bron</FoutMelding> <TriggerNiveau>1</TriggerNiveau> <VervolgOperator/> <FeatureKlasse>EDT_WEG_VLAK</FeatureKlasse> <AlsAttribuut>OBJECTID</AlsAttribuut> <AlsOperator>>=</AlsOperator> <AlsWaarde>0</AlsWaarde> <DanAttribuut>OBJECTID</DanAttribuut> <DanOperator>BRONCOUNT></DanOperator> <DanWaarde>0</DanWaarde> </AttribuutRegel>
1. New feature overlaps with existing features 2. No source for feature
Some lessons, topographic base data • Own (XML) encoding of constraints, maybe a standard would have been better; e.g. OCL • Same encoding of constraints used in different subsystems: • at data storage side/DBMS check-in and • at data edit side • Constraints not yet included in exchange format: some could possibly included in standard GML/XML; e.g. domains, but more research needed for others
Contents • Introduction • Constraints in a landscape design VR system • Constraints in a cadastral data set (topology) • Constraints in a topographic base data set • Constraints in web feature service transactions • Classification of constraints • Support for constraints • Conclusions and further research
Constraints in Web Feature Service transactions Applied to case ‘notary drafts Parcel boundary’ MSc-thesis project Thijs Brentjens
OGC Web Feature Services (WFS) • Defines interface to retrieve and edit geodata • Based on common web technologies: • HyperText Transfer Protocol (HTTP) • eXtensible Markup Language (XML) • Geography Markup Language (GML) • Basic WFS: Discovering and querying data • Transactional WFS: Insert, Update, Delete, Lock
Case study: Notary drafts parcel boundary • Cadastral transaction: • Transfer • Merge • Split • Notary drafts: • Preliminary boundaries • Annotation • Legal after surveying
The WFS protocol http://130.161.150.109:8080/geoserver/wfs/wfs?request= DescribeFeatureType&typeName=DRAFT_BOUNDARY,DRAFT_PARCEL • Pose a request (get two types of features): • XML/GML (geo-information, 2-way directions): <gml:MultiLineString srsName= "http://www.opengis.net/gml/srs/epsg.xml#28992"> <gml:lineStringMember> <gml:LineString> <gml:coordinates decimal="." cs="," ts=" "> 106417204,448719275 106367184,448675614 </gml:coordinates> </gml:LineString> </gml:lineStringMember> </gml:MultiLineString> </cad:SHAPE> <cad:OBJECT_ID>341411971</cad:OBJECT_ID> <cad:CLASSIF>31</cad:CLASSIF> <cad:STATUS_CD>0</cad:STATUS_CD>
Evaluation of Transactional WFS • WFS enables sharing & editing in heterogeneous, interoperable environment possible • Functions over the Web, limited to simple editing • Beyond simple editing: application logic? • Integrity constraints only on single features, not between features (XML/GML schema encoded) • Transferring (general) constraint knowledge to client not possible • Also constraints on operations (valid actions)? • WFS-T does not support true transactions, as a transaction may be partially successful
Contents • Introduction • Constraints in a landscape design VR system • Constraints in a cadastral data set (topology) • Constraints in a topographic base data set • Constraints in web feature service transactions • Classification of constraints • Support for constraints • Conclusions and further research