210 likes | 323 Vues
Designing and Performing Geographic Analysis Processes with GISCASE Cirano Iochpe, Guillermo N. Hess, Cláudio Ruschel, Alécio P. D. Binotto, Luciana V. da Rocha UFRGS – Instituto de Informática { ciochpe, hess, claudior, abinotto, vargas }@inf.ufrgs.br. Main Topics. Introduction
E N D
Designing and Performing Geographic Analysis Processes with GISCASE Cirano Iochpe, Guillermo N. Hess, Cláudio Ruschel, Alécio P. D. Binotto, Luciana V. da Rocha UFRGS – Instituto de Informática { ciochpe, hess, claudior, abinotto, vargas }@inf.ufrgs.br
Main Topics • Introduction • GeoFrame-A Framework • GISCASE’S Architecture • Implementation • Conclusions and Future Work
Introduction Each GIS tool supports its own logical model for both data and process design. A need: Models and tools that help the definition / design of geographic data and analysis processes. Tools used in GDB design could be candidates (ex: MADS, GeoOOA, GeoFrame), if they also supported process definition. GeoFrame-A: an extension to the GeoFrame Framework that aims to support the design of geographic analysis processes. Our proposal: GISCASE: software tool that implements GeoFrame-A concepts. It generates programs that can perform geographic analysis processes.
The GeoFrame-A Framework The GeoFrame Framework: GeoFrame is an object oriented conceptual framework on the basis of the Unified Modeling Language (UML) (Lisboa, 2000). It supports geographic database design by providing a set of classes that can be instatiated as well as specialized, and extended. GeoFrame-A: Extension that supports the design of geographic analysis processes (Ruschel, 2003).
The GeoFrame-A Framework • GeoFrame-A uses UML 2 diagrams to specify processes: • Class Diagram: external specification • Each geographic process type is represented as an Activity Class.
The GeoFrame-A Framework • Activity Diagram: internal specification • Data represented as object nodes; • Operations modeled as activity nodes; • Both data and control flow possible. • A set of basic geoprocessing operations {DS (Dissolve) ; OV (Overlay) ; SS (Spatial Selection) ; BF (Buffer) ...}
The GISCASE Tool GISCASE is a free software developed at UFRGS that generates source code in a programming language which, when compiled and executed, performs geographic analysis processes. The specification uses UML activity diagrams including GeoFrame-A concepts. Spatial classes are represented through spatial tables in a GDB. Operations must be implemented on a GIS software API. First implementation relies upon TerraLib.
GISCASE’s Architecture GisCase Main Window: Manages GISCASE’s workflow. Elements: navigation panel, text editor, message window
GISCASE’s Architecture Graphical Editor Activity diagrams: CASE tool Poseidon UML (Community Edition)
GISCASE’s Architecture GPtoXML Parser Reads the XMI file and performs a semantic analysis. Result: a clean XML file, from which code generation is possible.
GISCASE’s Architecture GPtoXML Parser XMI File <UML:CallAction xmi.id = 'I20699am10384031526mm7fce' name = '' isSpecification = 'false' isAsynchronous = 'false'> <UML:Action.script> <UML:ActionExpression xmi.id = 'I20699am10384031526mm7f99' language = 'java' body = 'DS_1'/> </UML:Action.script> </UML:CallAction> XML-Schema <xs:element name="Action" substitutionGroup="aux2"> <xs:complexType> <xs:sequence> <xs:element ref="Name"/> <xs:element ref="Input" minOccurs="0" maxOccurs="unbounded"/> <xs:element ref="Output" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="ActionId" type="xs:ID" use="required"/> <xs:attribute name="Persistent" type="xs:integer" use="optional"/> </xs:complexType> </xs:element> Elements from the XMI file are coded into a new XML file, based on a XML-Schema (the XML encode for GeoFrame-A). Generated XML File <Spatial ObjectNodeId="GisCase_AC2"> <Name>GisCase_DS_1</Name> <Representation>polygon</Representation> <TableName>GisCase_DS_1</TableName> </Spatial>
GISCASE’s Architecture GPtoXML Parser • Object nodes serve as either input or output for Action nodes. • Each action node can have one or more input nodes but only one output. • Actions are verified within GP Rules database: • Number of inputs for each action; • Data types of the inputs and outputs.
GISCASE’s Architecture XMLtoGIS Generator Generates source code from the XML specification.
GISCASE’s Architecture XMLtoGIS Generator For each GIS software an API is needed in order to map GeoFrame-A operations onto the logical model of the GIS software. Mapping the buffer operation to TerraLib bool GcBuffer(string inLayerName, TeGeomRep inRepName, string outLayerName, double dist, TeAdo* db) { TeLayer* inLayer = new TeLayer(inLayerName); db->loadLayer(inLayer); TeProjection* proj = inLayer->projection (); ... TePolygonSet bufferPol; TeLayer* outLayer = new TeLayer(outLayerName, db, inLayer->box(), inLayer->projection()); int layerId = outLayer->id(); db->Buffer(tableRep, inRepName ,objsIn, bufferPol, dist); outLayer->addPolygons(bufferPol); } This module generates the source code that accesses the GIS operations through its API, passing respective parameters when needed. The source code generated must be compiled and linked with the required GIS libraries, or interpreted within the GIS software environment.
Implementation As a free software project sponsored by CNPq, all the external components adopted are free software. Interface and parsers built in Java: free software, platform independent, easy to parse XML files GISCASE’s exclusive Library to access TerraLib API developed in C++
Implementation The XMLtoGIS module generates a main procedure and appends the source code for the operations used in the process from the library GcGeoOperations for TerraLib. int main(){ string dbname = "C:\GeoDB\Geoinfo.mdb"; TeAdo* db = new TeAdo(); db->connect("localhost","","",dbname,0)) cout << "Erro em conetar-se via ADO: " << db->errorMessage() << endl; TeAdoPortal* dbPortal = new TeAdoPortal(db); TeDatabasePortal* portal = dbPortal; TeInitQuerierStrategies(); val = GcDissolve("Municipality","GisCase_DS_1","IDADMREGION",db, portal); if (!val) cout << "Erro na função GcDissolve!" << endl; val = GcOverlay("GisCase_DS_1","River_Basin","Region_by_Basin","AND",db, portal); if (!val) cout << "Erro na função GcOverlay!" << endl; portal->freeResult(); db->close(); return 0; }
Implementation • GcGeoOperations Library for TerraLib • Source code that maps the main procedure to TerraLib library and TerraView functions. • Operations implemented in the first version: • GcSelection: selects objects by attributes • GcRegionSelection: selects objects inside a polygon • GcSpatialSelection: selects objects through a spatial predicate • GcBuffer: creates a polygon with a specified distance • GcOverlay: does the overlay of two sets of spatial objects • GcDissolve: generalizes the input objects through an attribute • GcCentroid: finds the centroid of a polygon • GcAlgebra: updates attributes in one layer (SQL Update) • GcDistance: mesures the distance of two geometries
Workflow to perform a geographic analysis process with GISCASE: • Prepare a GDB, compatible to the GIS API, with the input data • In the GISCASE tool: • - Design the process in the graphical editor • - Verify semantics and generate source code • Compile and execute (for TerraLib, with Visual Studio) • Verify the results in a map viewer (ex: TerraView)
Contributions: • a XML schema able to define a geographic process • complements a set of applications developed with TerraLib • a modular and extendable architecture to design geographic process • a learning tool to programmers • Future work: • to implement other geographic analysis operations still using TerraLib • code generation for other GIS platforms • allow the use of a script language as an alternative to the graphical editor