Created by Alessandro Furieri (Italy) First release published in 2008

Slides:



Advertisements
Similar presentations
Geo GIS Practicuum Introduction to ArcGIS 8 Exercise 5 - ESRI Virtual Campus Chapters 1-2, ArcGIS Methods …
Advertisements

JTX Overview Overview of Job Tracking for ArcGIS (JTX)
SQLite is a software library. It is: self-contained + Serverless + zero-configuration transactional = SQL database engine. Most widely deployed. The source.
Introducing ArcGIS Desktop
ArcGIS Geodatabase Miles Logsdon Spatial Information Technologies, UW Garry Trudeau - Doonesbury.
Benefits and Concerns when Constructing an Enterprise-scale Geodatabase Larry Theller, presenter Agricultural and Biological Engineering Dept Purdue University.
Manipulating MySQL Databases with PHP. PHP and mySQL2 Objectives Connect to MySQL from PHP Learn how to handle MySQL errors Execute SQL statements with.
19 th Advanced Summer School in Regional Science An introduction to GIS using ArcGIS.
TECNOLOGIAS DE ARMAZENAMENTO DE INFORMAÇÃO ESPACIAL.
ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008.
School of Geography FACULTY OF ENVIRONMENT Introduction to ArcGIS 1.
Working with GIS: Introduction to ArcGIS. In preparation for the first lab, you will: Be briefly introduced to the ArcGIS product family of ArcView, ArcEditor,
Esri International User Conference | San Diego, CA Demo Theater | Using Spatial Data in ArcGIS with Query Layers Brent Pierce Thursday, July 14 th.
Working with SQL and PL/SQL/ Session 1 / 1 of 27 SQL Server Architecture.
Simple Web SQLite Manager/Form/Report
SQLite BY Jordan Smith Brian Wetzel Chris Hull William Anderson.
Confidential ODBC May 7, Features What is ODBC? Why Create an ODBC Driver for Rochade? How do we Expose Rochade as Relational Transformation.
Intro. To GIS Lecture 4 Data: data storage, creation & editing
Module 2: Using Transact-SQL Querying Tools. Overview SQL Query Analyzer Using the Object Browser Tool in SQL Query Analyzer Using Templates in SQL Query.
Chapter 5 Using SAS ® ETL Studio. Section 5.1 SAS ETL Studio Overview.
Create with SharePoint 2010 Jen Dodd Sr. Solutions Consultant
“This presentation is for informational purposes only and may not be incorporated into a contract or agreement.”
ArcGIS Workflow Manager An Introduction
Gary MacDougall Premjit Singh Managing your Distributed Data.
Esri UC 2014 | Technical Workshop | Accessing Spatial Databases in ArcGIS using Query Layers Annie Sasidar.
Cube Enterprise Database Solution presented to MTF GIS Committee presented by Minhua Wang Citilabs, Inc. November 20, 2008.
Sep , 2006 v FME Worldwide User Conference - Vancouver What’s New in ArcGIS Data Interoperability Extension Kim Avery, ESRI, California, USA, and.
ASP.NET Programming with C# and SQL Server First Edition
Extending ArcGIS for Server
9. Introduction to ArcObjects Most GIS analysis carried out within a GIS consists of a labor- intensive sequence of steps. Automating a GIS makes it possible.
material assembled from the web pages at
Session 4: The HANA Curriculum and Demos Dr. Bjarne Berg Associate professor Computer Science Lenoir-Rhyne University.
The 2000 Decennial Census School District Project: Using Census Data for the School District Mapping System **** Development and Implementation Tai A.
GIS On The Web: An Overview of ArcIMS. *The easy flow of geographic data can offer real-life solutions in many societal sectors, including municipal government,
Data Interoperability Basics Bruce Harold & Dale Lutz.
Introduction of Geoprocessing Topic 7a 4/10/2007.
GTRI_B-1 FalconView GIS Editor / UNCLASSIFIED - 1 The FalconView TM GIS Editor.
Esri UC 2014 | Technical Workshop | Esri Roads and Highways: Integrating and Developing LRS Business Systems Tom Hill.
Data Management Console Synonym Editor
ARCSDE & ARCIMS Mr. David A. Perini. ARCIMS  Internet Mapping Server Distribute GIS information over the Internet Integrates with addition ESRI softwareESRI.
SQL access and working with ST_Geometry Functions
Understanding our world.. Technical Workshop 2013 Esri International User Conference July 8–12, 2013 | San Diego, California Editing Versioned Geodatabases.
Technical Workshops | Esri International User Conference San Diego, California Creating Geoprocessing Services Kevin Hibma, Scott Murray July 25, 2012.
Introduction to GeoDatabase Lecture
Enterprise Data Model for Transportation Planning Presentation to 2009 TRB Planning Application Conference Minhua Wang, Ph.D. Citilabs, Inc.
Esri UC 2014 | Technical Workshop | Editing Versioned Geodatabases : An Introduction Cheryl Cleghorn and Shawn Thorne.
Intro to GIS | Summer 2012 Attribute Tables – Part 1.
WalkLite in Mobile GIS: A Schema to Extend and Symbolize SpatiaLite Dr. X. Chen Walkinfo Tech. Co. Ltd.
Introduction of Geoprocessing Lecture 9. Geoprocessing  Geoprocessing is any GIS operation used to manipulate data. A typical geoprocessing operation.
Migrating Data into the Parcel Fabric in ArcMap
Introduction of Geoprocessing Lecture 9 3/24/2008.
Kurt Menke, GISP Quantum GIS (QGIS) Plugins. Extending QGIS Plugins Think ArcGIS extensions and script tools Core Plugins Core Plugins Contributed Plugins.
Introduction to Core Database Concepts Getting started with Databases and Structure Query Language (SQL)
CS 440 Database Management Systems Stored procedures & OR mapping 1.
Excel Services Displays all or parts of interactive Excel worksheets in the browser –Excel “publish” feature with optional parameters defined in worksheet.
Introduction to MySQL  Working with MySQL and MySQL Workbench.
uses of DB systems DB environment DB structure Codd’s rules current common RDBMs implementations.
Coastal Applications Using ArcGIS eCoastal Database Model Data Management Introduction to eCoastal Part II Exercise A Finding Coastal Data Exercise B Creating.
Introduction to Database Programming with Python Gary Stewart
SQL and SQL*Plus Interaction
How to pack a punch for free
Spatial Databases SpatiaLite & PostGIS.
Computer Science Projects Database Theory / Prototypes
Network Analyst – Automating Workflows with Geoprocessing
ArcCatalog and Geodatabases
Geodatabase Best Practices
Presentation transcript:

Spatialite http://www.gaia-gis.it/gaia-sins/ Created by Alessandro Furieri (Italy) First release published in 2008 SpatiaLite is an open source library intended to extend the SQLite core to support fully fledged Spatial SQL capabilities. SpatiaLite is smoothly integrated into SQLite to provide a complete and powerful Spatial DBMS (mostly OGC-SFS compliant).

SQLite http://www.sqlite.org/ Created by Richard Hipp First release published in 2000 SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. SQLite is the most widely deployed SQL database engine in the world. A single lightweight library implementing the full SQL engine standard SQL implementation: almost complete SQL-92 no complex client/server architecture no installation, no configuration

What do you need to get started? Spatialite Spatialite_GUI Program http://www.gaia-gis.it/gaia-sins/ SQLite SQLite Manager (Firefox plugin) Install extension from Firefox browser

Resources SQLite: http://www.sqlite.org/ -File based relational database Spatialite: http://www.gaia-gis.it/gaia-sins/ -SQLite extension for gis functionality GDAL: http://www.gdal.org/ -Set of libraries for ETL operations with multiple GIS formats QGIS: http://www.qgis.org/ -Open Source GIS application OSGeo4W: http://trac.osgeo.org/osgeo4w/ -Installer for suite of open source GIS software and tools GIS

Spatialite GUI Application

SQLite database files

DEMO Spatialite GUI Shapefile loader GDAL Command line Load shapefile, file geodatabase

Loading Shapefile in Spatialite GUI Load Shapefile

Using GDAL to load data into Spatialite

Using GDAL to load data into Spatialite -Load shapefile into Spatialite database ogr2ogr –update –append –f SQLite C:\GISData\NDIC\ndic.sqlite C:\GISData\NDIC\shapefiles\Horizontals_Lines.shp Horizontals_Lines –nln Horizontals_Lines Shapefile directory to Spatialite (windows): for %f in (/GISData/NDIC/*.shp) do ( ogr2ogr -update -append -t_srs ESPGS:4267 -f SQLite C:\GISData\NDIC\ndic.sqlite GISData\NDIC\%f -nln layers) -Load file geodatabase feature class into Spatialite database ogr2ogr –update –append –f SQLite C:\GISData\NDIC\ndic.sqlite MTND_CadNSDI.gdb PLSSFirstDivision –nln Landgrid_PLSS_Sections

Firefox SQLite Manager DEMO Firefox SQLite Manager Spatialite GUI

Using Firefox SQLite Manager -Basic query

Spatialite GUI -Basic query

Spatialite GUI -query with spatial function

Using Firefox SQLite Manager -Trying to use spatial functions in query

SQLite vs Spatialite new database structure Spatial Metadata Empty

Pros Cons Cross-platform No custom installation to use Single file for transport Simple access to SQL queries Large spatial function library Transform geometries within sql query Fast prototyping of geodatase modeling and analysis Cons Only simple multi-editor environment, no conflict management Less performant than server based RDBMS

Who is Spatialite for? Non-Enterprise user Users with reasonable size datasets User wanting to get started with SQL Users needing another GIS tool in their belt User familiar with SQL wanting access to spatial functions User who needs functionality of RDBMS but does not have access to servers

Who is Spatialite NOT for? Enterprise user who needs maximum performance Users who need a robust multi-editor environment with conflict management User who have very large datasets

DEMO Spatialite GUI Query examples

Spatialite GUI -Basic query

Spatialite GUI -query with spatial function

Multiple While Loop Operations SQL Server Non-Spatial Queries SQL Server MGMT Studio – Midpoint on Linestring USE database IF OBJECT_ID('tempdb..#NDIC_HORZ_LIST') IS NOT NULL DROP TABLE #NDIC_HORZ_LIST SET NOCOUNT OFF -- Create temp table to hold the OBJECTID and apply filter on wells without enough points CREATE CLUSTERED INDEX idx_NDIC_HORZ_LIST_lineid ON #NDIC_HORZ_LIST(lineID) SELECT lineID = identity (int,1,1), OBJECTID INTO #NDIC_HORZ_LIST FROM database.dbo.API12_PATHS CREATE INDEX idx_NDIC_HORZ_LIST_objectid ON #NDIC_HORZ_LIST(OBJECTID) DECLARE @midPoint geometry DECLARE @point1Y numeric(25,20) DECLARE @point1X numeric(25,20) DECLARE @point2X numeric(25,20) DECLARE @point2Y numeric(25,20) DECLARE @xDiff numeric(25,20) DECLARE @yDiff numeric(25,20) DECLARE @workingLineLength1 numeric(25,20) = 0 DECLARE @workingLineLength2 numeric(25,20) = 0 DECLARE @lineLength numeric(25,20) DECLARE @i int DECLARE @lineID int DECLARE @lineOID INT DECLARE @line geometry DECLARE @workLine geometry DECLARE @lastSegment geometry DECLARE @lineFromString NVARCHAR(MAX) SET @lineID = 1 -- Outer loop to iterate over lines in table, using the counts from the temp table WHILE @lineID <= (SELECT COUNT(*) FROM #NDIC_HORZ_LIST) -- Assign OBJECTID FROM Temp table to variable BEGIN SET @lineOID = (SELECT OBJECTID FROM #NDIC_HORZ_LIST WHERE lineID = @lineID) -- Assign SHAPE From table to geometry variable SET @lineLength = @line.STLength() / 2 SET @line = (SELECT SHAPE FROM database.dbo.API12_PATHS WHERE OBJECTID = @lineOID) SET @lineFromString = 'LINESTRING(' SET @i = 1 WHILE @workingLineLength2 < @lineLength -- Loop through points in line until the working length is longer than half the line length -- For first point add start point from line IF @i = 1 SET @lineFromString = @lineFromString + CAST(@line.STStartPoint().STX AS VARCHAR(10)) + ' ' + CAST(@line.STStartPoint().STY AS VARCHAR(10)) + ')' END ELSE -- Strip the trailing ) from the line string text SET @lineFromString = LEFT(@lineFromString, LEN(@lineFromString) - 1) SET @lineFromString = @lineFromString + ',' + CAST(@line.STPointN(@i).STX AS VARCHAR(10)) + ' ' + CAST(@line.STPointN(@i).STY AS VARCHAR(10)) + ')' SET @workLine = geometry::STGeomFromText(@lineFromString, 4267) CAST(@line.STPointN(@i - 1).STX AS VARCHAR(10)) + ' ' + CAST(@line.STPointN(@i - 1).STY AS VARCHAR(10)) + ',' + SET @lastSegment = geometry::STGeomFromText('LINESTRING(' + CAST(@line.STPointN(@i).STX AS VARCHAR(10)) + ' ' + CAST(@line.STPointN(@i).STY AS VARCHAR(10)) + ')', 4267) SET @workingLineLength2 = @workLine.STLength() IF @workingLineLength2 > @lineLength SET @point1X = @line.STPointN(@i - 1).STX SET @point1Y = @line.STPointN(@i - 1).STY SET @point2X = @line.STPointN(@i).STX SET @point2Y = @line.STPointN(@i).STY SET @xDiff = (@point2X - @point1X) * ((@lineLength - @workingLineLength1) / @lastSegment.STLength()) SET @yDiff = (@point2Y - @point1Y) * ((@lineLength - @workingLineLength1) / @lastSegment.STLength()) SET @midPoint = geometry::STGeomFromText('POINT(' + CAST(@point1X + @xDiff AS VARCHAR(25)) + ' ' + CAST(@point1Y + @yDiff AS VARCHAR(25)) + ')',4267) SELECT INSERT INTO database.dbo.API10_SHL(OBJECTID,SHAPE) ROW_NUMBER() OVER(ORDER BY t2.OBJECTID), @midPoint FROM database.dbo.API12_PATHS AS t2 SET @workingLineLength1 = @workingLineLength2 SET @i = @i + 1 SET @lineID = @lineID + 1 Multiple While Loop Operations SLOWER

Spatialite GUI -query with spatial function

Spatialite GUI -attach to another sqlite database SQL Query GUI

-Query using join to attached database Spatialite GUI -Query using join to attached database

Spatialite Spatial Functions GeomFromExifGpsBlob PointFromWKB IsSimple NumPoints SingleSidedBuffer SridFromAuthCRS MakePoint LineFromWKB IsValid PointN SharedPaths ShiftCoords MakePointZ LineStringFromWKB Boundary Centroid Line_Interpolate_Point ShiftCoordinates MakePointM PolyFromWKB Envelope Area Line_Interpolate_Equidistant_Points ST_Translate MakePointZM PolygonFromWKB Expand ExteriorRing Line_Locate_Point ST_Shift_Longitude MakeLine MPointFromWKB NPoints NumInteriorRing Line_Substring NormalizeLonLat TriangularGrid MultiPointFromWKB NRings NumInteriorRings ClosestPoint ScaleCoords HexagonalGrid MLineFromWKB Reverse InteriorRingN ShortestLine ScaleCoordinates BuildMbr MultiLineStringFromWKB ForceLHR NumGeometries Snap RotateCoords BuildCircleMbr MPolyFromWKB SanitizeGeometry GeometryN Collect RotateCoordinates Extent MultiPolygonFromWKB CompressGeometry MbrEqual ReflectCoords ToGARS GeomCollFromWKB UncompressGeometry MbrDisjoint LineMerge ReflectCoordinates GARSMbr GeometryCollectionFromWKB CastToPoint MbrTouches BuildArea SwapCoords MbrMinX BdPolyFromWKB CastToLinestring MbrWithin Polygonize SwapCoordinates MbrMinY BdMPolyFromWKB CastToPolygon MbrOverlaps UnaryUnion InitSpatialMetaData MbrMaxX AsText CastToMultiPoint MbrIntersects DissolveSegments InsertEpsgSrid MbrMaxY AsWKT CastToMultiLinestring EnvelopesIntersects DissolvePoints AddGeometryColumn ST_MinZ AsBinary CastToMultiPolygon MbrContains LinesFromRings RecoverGeometryColumn MaxZ AsSVG CastToGeometyCollection Equals LinesCutAtNodes DiscardGeometryColumn MinM AsKml CastToMulti Disjoint RingsCutAtNodes RegisterVirtualGeometry MaxM GeomFromKml CastToSingle Touches CollectionExtract DropVirtualGeometry GeomFromText AsGml CastToXY Within LocateAlongMeasure CreateSpatialIndex ST_WKTToSQL GeomFromGML CastToXYZ Overlaps LocateBetweenMeasures CreateMbrCache PointFromText AsGeoJSON CastToXYM Crosses DelaunayTriangulation DisableSpatialIndex LineFromText GeomFromGeoJSON CastToXYZM Intersects VoronojDiagram CheckSpatialIndex LineStringFromText AsEWKB X Contains ConcaveHull RecoverSpatialIndex PolyFromText GeomFromEWKB Y Covers MakeValid UpdateLayerStatistics PolygonFromText AsEWKT Z CoveredBy MakeValidDiscarded CreateTopologyTables MPointFromText GeomFromEWKT M Relate Segmentize CheckSpatialMetaData MultiPointFromText AsFGF StartPoint Distance Split AutoFDOStart MLineFromText GeomFromFGF EndPoint PtDistWithin SplitLeft AutoFDOStop MultiLineStringFromText Dimension Length Intersection SplitRight InitFDOSpatialMetaData MPolyFromText CoordDimension Perimeter Difference Azimuth AddFDOGeometryColumn MultiPolygonFromText NDims Geodesic Length GUnion SnapToGrid RecoverFDOGeometryColumn GeomCollFromText Is3D Great Circle Length GeoHash DiscardFDOGeometryColumn GeometryCollectionFromText IsMeasured IsClosed SymDifference AsX3D FilterMbrWithin BdPolyFromText GeometryType IsRing Buffer MaxDistance FilterMbrContains BdMPolyFromText SRID PointOnSurface ConvexHull 3DDistance FilterMbrIntersects GeomFromWKB SetSRID Simplify HausdorffDistance 3DMaxDistance BuildMbrFilter ST_WKBToSQL IsEmpty SimplifyPreserveTopology OffestCurve Transform RTreeIntersects RTreeDistWithin RTreeContains RTreeWithin

Using Spatialite in ArcMap Read-only access was added at 10.2 Can use geoprocessing tools with layers but with limitations Using layers for geoprocessing input and output to different format seems to work pretty well. Can write results to sqlite database, but pretty buggy at 10.2.1 Recommend using as read-only access at current version Cannot be published to ArcGIS Server Cannot be edited through ArcMap

DEMO Spatialite functions SQL in Spatialite GUI View layers in ArcMap

Interpolated point along line Spatialite GUI Interpolated point along line Use as midpoint

ArcMap - Midpoints

Geometry transformation inline function Spatialite GUI Line offset Geometry transformation inline function

ArcMap Line offset

Spatialite GUI Single Sided Buffer

Spatialite GUI Buffer

ArcMap Single Sided Buffer

Single Sided Buffer vs Buffer ArcMap Single Sided Buffer vs Buffer

Convex Hull vs Concave Hull Spatialite GUI Convex Hull vs Concave Hull

Convex Hull vs Concave Hull ArcMap Convex Hull vs Concave Hull Convex Hull Concave Hull

Using Spatialite in QGIS Read/Write Access Direct Editing of features DBManager – Execute queries on SQLite database inside QGIS

DEMO Spatialite editing in QGIS SQL in QGIS DB Manager

-Connecting to Spatialite database Spatialite Editing -Connecting to Spatialite database

Spatialite Editing -Creating new table SQL Query Editor

Spatialite Editing -Add Geometry Column

Spatialite Editing -Add new table to map

Spatialite Editing -Editing new layer

-Query new feature in Spatialite Spatialite Editing -Query new feature in Spatialite

-View new feature in ArcMap Spatialite Editing -View new feature in ArcMap

QGIS Query Layer Single Sided Buffer

QGIS Single Sided Buffer

THE END

- DBManager spatial query and add to map QGIS Query Layer - DBManager spatial query and add to map

QGIS Line offset

QGIS – DBManager -Sql window, create new layer from sql query

QGIS – DBManager -Sql window, create new layer from sql query -Subset of data based on ST_Intersects

Resources SQLite: http://www.sqlite.org/ -File based relational database Spatialite: http://www.gaia-gis.it/gaia-sins/ -SQLite extension for gis functionality Geopackage: http://www.geopackage.org -OGC standard for exchange format GDAL: http://www.gdal.org/ -Set of libraries for ETL operations with multiple GIS formats QGIS: http://www.qgis.org/ -Open Source GIS application OSGeo4W: http://trac.osgeo.org/osgeo4w/ -Installer for suite of open source GIS software and tools GIS

Spatialite GUI Interpolated points along line Geometry transformation inline function

- Interpolated points along line ArcMap - Interpolated points along line

Delaunay Triangulation Spatialite GUI Delaunay Triangulation

Delaunay Triangulation ArcMap Delaunay Triangulation