Sunteți pe pagina 1din 179

Baze de date spatiale

Componente GIS

CITY OF REDLANDS
Employee Identification Card
ID: 8005 Name: Jeff Wessman

Title: Surveyor
Attributes
Department: Public Works

Joined: 01/04/2015

Address: 380 New York St


Redlands, CA 92373

Location
Componente GIS

Hardware Software Date Oameni Fluxuri


Capabilități GIS

Colectare și Cartografiere Analiză spațială


management de date

Vizualizare în timp Vizualizare 3D Teledecție


real

Lucru în teren
Abordare geografică
2. Colectare

1. Cerințe

3. Examinare

5. Decizie

4. Analiză
Date
Localizare proprietăți date
Metadate Atribute Referință spațială
Modele de date
Vector Raster

Tabular
Vector

Poligoane

Linii

Realitate Puncte

Vector
Vector
Puncte

Linii

Poligoane
Raster

Realitate

Raster
Obiecte transpuse în GIS

Arbori
Straturi tematice Drumuri
Harta
Parcuri

= + Vegetație

Hăți de fundal Imagini satelitare


Editare

Attributes Geometry
Editare
• Digitalizare
• Șabloane de obiecte
• Snapping

Vertex
End

Edge
Administrare date geografice
Administrare date
• Stocare, administrare, organizare de date geografice

Feature classes Raster


Tables (vector) datasets

Geodatabase
Utilizare date geografice

Date geografice Strat tematic

Date geografice

Strat tematic Strat tematic


Metadata Descriere

Data calendaristică Realizator

Sursă utilizată Informații generale

Metadata

Proprietar Utilizare și drepturi de acces

Cuvinte cheie
Reprezentare pe hartă
Reprezentare pe hartă
Sisteme de coordonate

Geographic coordinate system Projected coordinate system


Dimensiune Tri-dimensional, sferic Bi-dimensional, plan
Unități de Grade Metri, picioare etc
măsură
Scop Localizare obiecte Măsurători exacte pentru
distanțe, suprafețe, unghiuri etc
Transformări geografice
Datum centrul
Datum local
Pământului
Proiecții cartografice
Proiecții cartografice si distorsiuni
• Formă
• Aria
• Distanță
Equal Area Conformal
• Direcție

Equidistant Azimuthal (directional)


Baze de date
SGBD spațial

https://en.wikipedia.org/wiki/Spatial_database
SGBD spațial – tip date
Geometry Geography

Connecting edges
- Linie dreapta - Arc de cerc
Elemente circulare
- Definite pe un sistem de coordonate cartezian - Definite pe un sistem de referinta de tip sfera
(fara Z)
Masuratori
- Aceiasi unitate de masura - Coordonate exprimate in grade, distante si
suprafete exprimate in metri
Orientarea obiectelor spatiale
- Sistem de coordonate plan - nicio restrictie - Sistem de coordonate elipsoidal:
- un obiect localizat doar intr-o singura
emisfera

https://en.wikipedia.org/wiki/Spatial_database
SGBD spațial – tip date - Geometry-Geography
IF OBJECT_ID ( 'dbo.SpatialTable', 'U' ) IS NOT NULL
DROP TABLE dbo.SpatialTable;
GO

CREATE TABLE SpatialTable


( id int IDENTITY (1,1),
GeomCol1geography,
GeogCol1 geometry,
GeomCol2AS
GeogCol2 ASGeogCol1.STAsText()
GeomCol1.STAsText()); );
GO

INSERT INTO SpatialTable (GeogCol1)


(GeomCol1)
VALUES (geography::STGeomFromText('LINESTRING(-122.360
(geometry::STGeomFromText('LINESTRING (100 100, 20 47.656,
180, 180
-122.343
180)',47.656
0));
)', 4326));
INSERT INTO SpatialTable (GeomCol1)
VALUESINTO
INSERT (geometry::STGeomFromText('POLYGON
SpatialTable (GeogCol1) ((0 0, 150 0, 150 150, 0 150, 0 0))',
0));
VALUES (geography::STGeomFromText('POLYGON((-122.358 47.653 , -122.348 47.649,
GO
-122.348 47.658, -122.358 47.658, -122.358 47.653))', 4326));
GO
https://en.wikipedia.org/wiki/Spatial_database
SGBD spațial – tip date - Geometry-Geography
DECLARE @geom1 geometry;
DECLARE @geom2 geometry;
DECLARE @result geometry;

SELECT @geom1 = GeomCol1 FROM SpatialTable WHERE id = 1;


SELECT @geom2 = GeomCol1 FROM SpatialTable WHERE id = 2;
SELECT @result = @geom1.STIntersection(@geom2);
SELECT @result.STAsText();
DECLARE @geog1 geography;
DECLARE @geog2 geography;
DECLARE @result geography;

SELECT @geog1 = GeogCol1 FROM SpatialTable WHERE id = 1;


SELECT @geog2 = GeogCol1 FROM SpatialTable WHERE id = 2;
SELECT @result = @geog1.STIntersection(@geog2);
SELECT @result.STAsText();

https://en.wikipedia.org/wiki/Spatial_database
SGBD spațial – tip date – Geometry-Geography
IF OBJECT_ID ( 'dbo.SpatialTable', 'U' ) IS NOT NULL IF OBJECT_ID ( 'dbo.SpatialTable', 'U' ) IS NOT NULL
DROP TABLE dbo.SpatialTable; DROP TABLE dbo.SpatialTable;
GO GO

CREATE TABLE SpatialTable CREATE TABLE SpatialTable


( (
locationId int IDENTITY(1,1), locationId int IDENTITY(1,1),
location geometry, location geography,
deliveryArea as location.STBuffer(10) persisted deliveryArea as location.STBuffer(10) persisted
) );

https://en.wikipedia.org/wiki/Spatial_database
SGBD spațial – tip date - Geography
IF OBJECT_ID ( 'dbo.SpatialTable', 'U' ) IS NOT NULL
DROP TABLE dbo.SpatialTable;
GO

CREATE TABLE SpatialTable


( id int IDENTITY (1,1),
GeogCol1 geography,
GeogCol2 AS GeogCol1.STAsText() );
GO

INSERT INTO SpatialTable (GeogCol1)


VALUES (geography::STGeomFromText('LINESTRING(-122.360 47.656, -122.343 47.656
)', 4326));

INSERT INTO SpatialTable (GeogCol1)


VALUES (geography::STGeomFromText('POLYGON((-122.358 47.653 , -122.348 47.649,
-122.348 47.658, -122.358 47.658, -122.358 47.653))', 4326));
GO
https://en.wikipedia.org/wiki/Spatial_database
SGBD spațial – tip date - Punct
DECLARE @g geometry;
SET @g = geometry::STGeomFromText('POINT (3 4)', 0);

DECLARE @g geometry;
SET @g = geometry::Parse('POINT(3 4 7 2.5)');

SELECT @g.STX;
SELECT @g.STY;
SELECT @g.Z;
SELECT @g.M;

DECLARE @g geometry;
SET @g = geometry::Parse('POINT(3 4 NULL NULL)');

https://en.wikipedia.org/wiki/Spatial_database
SGBD spațial – tip date - Linie
DECLARE @g1 geometry = 'LINESTRING EMPTY'; DECLARE @g geometry = 'LINESTRING(1 1)';
DECLARE @g2 geometry = 'LINESTRING(1 1,2 3,4 8, -6 3)';
DECLARE @g3 geometry = 'LINESTRING(1 1, 1 1)'; DECLARE @g geometry
SET @g = geometry::STGeomFromText('LINESTRING(1 3, 1 3)',0);
IF @g.STIsValid() = 1
BEGIN
SELECT @g.ToString() + ' is a valid LineString.';
END
ELSE
BEGIN
SELECT @g.ToString() + ' is not a valid LineString.';
DECLARE @g1 geometry= 'LINESTRING EMPTY'; SET @g = @g.MakeValid();
DECLARE @g2 geometry= 'LINESTRING(1 1, 3 3)'; SELECT @g.ToString() + ' is a valid Point.';
DECLARE @g3 geometry= 'LINESTRING(1 1, 3 3, 2 4, 2 0)'; END
DECLARE @g4 geometry= 'LINESTRING(1 1, 3 3, 2 4, 2 0, 1 1)';
SELECT @g1.STIsValid(), @g2.STIsValid(), @g3.STIsValid(),
@g4.STIsValid();
https://en.wikipedia.org/wiki/Spatial_database
SGBD spațial – tip date - Linie

DECLARE @g geometry;
SET @g = geometry::STGeomFromText('LINESTRING(1 1, 2 4, 3 9)', 0);

DECLARE @g geometry;
SET @g = geometry::STGeomFromText('LINESTRING(1 1 NULL 0, 2 4 NULL 12.3, 3 9 NULL 24.5)', 0);

https://en.wikipedia.org/wiki/Spatial_database
SGBD spațial – tip date – Linie circulara
DECLARE @g1 geometry = 'CIRCULARSTRING EMPTY';
DECLARE @g2 geometry = 'CIRCULARSTRING(1 1, 2 0, -1 1)';
DECLARE @g3 geometry = 'CIRCULARSTRING(1 1, 2 0, 2 0, 2 0, 1 1)';

DECLARE @g1 geometry = 'CIRCULARSTRING EMPTY';


DECLARE @g2 geometry = 'CIRCULARSTRING(1 1, 2 0, -1 1)';
DECLARE @g3 geometry = 'CIRCULARSTRING(1 1, 2 0, 2 0, 1 1, 0 1)';
DECLARE @g4 geometry = 'CIRCULARSTRING(1 1, 2 2, 2 2)';
SELECT @g1.STIsValid(), @g2.STIsValid(), @g3.STIsValid(),@g4.STIsValid();

DECLARE @g1 geometry = 'CIRCULARSTRING(1 1, 2 0, 1 1)';


DECLARE @g2 geometry = 'CIRCULARSTRING(0 0, 0 0, 0 0)';
SELECT @g1.STIsValid(), @g2.STIsValid();

https://en.wikipedia.org/wiki/Spatial_database
SGBD spațial – tip date – Linie compusa

DECLARE @g1 geometry = 'COMPOUNDCURVE EMPTY';


DECLARE @g2 geometry = 'COMPOUNDCURVE(CIRCULARSTRING(1 0, 0 1, -1 0), (-1 0, 2 0))';

DECLARE @g1 geometry = 'COMPOUNDCURVE EMPTY';


DECLARE @g2 geometry = 'COMPOUNDCURVE(CIRCULARSTRING(1 0, 0 1, -1 0), (-1 0, 2 0))';
DECLARE @g3 geometry = 'COMPOUNDCURVE(CIRCULARSTRING(1 1, 1 1, 1 1), (1 1, 3 5, 5 4))';
SELECT @g1.STIsValid(), @g2.STIsValid(), @g3.STIsValid();

DECLARE @g1 geometry = 'COMPOUNDCURVE(CIRCULARSTRING(1 1, 1 1, 1 1), (1 1, 3 5, 5 4, 3 5))';


DECLARE @g2 geometry = 'COMPOUNDCURVE((1 1, 1 1))';
DECLARE @g3 geometry = 'COMPOUNDCURVE(CIRCULARSTRING(1 1, 2 3, 1 1))';
SELECT @g1.STIsValid(), @g2.STIsValid(), @g3.STIsValid();
SGBD spațial – tip date – Poligon
DECLARE @g1 geometry = 'POLYGON EMPTY';
DECLARE @g2 geometry = 'POLYGON((1 1, 3 3, 3 1, 1 1))';
DECLARE @g3 geometry = 'POLYGON((-5 -5, -5 5, 5 5, 5 -5, -5 -5),(0 0, 3 0, 3 3, 0 3, 0 0))';
DECLARE @g4 geometry = 'POLYGON((-5 -5, -5 5, 5 5, 5 -5, -5 -5),(3 0, 6 0, 6 3, 3 3, 3 0))';
DECLARE @g5 geometry = 'POLYGON((1 1, 1 1, 1 1, 1 1))';

DECLARE @g1 geometry = 'POLYGON((1 1, 3 3, 1 1))';


DECLARE @g2 geometry = 'POLYGON((1 1, 3 3, 3 1, 1 5))';
SGBD spațial – tip date – Poligon
DECLARE @square GEOGRAPHY;
SET @square = GEOGRAPHY::STPolyFromText('POLYGON((0 20, 20 20, 20 0, 0 0, 0 20))', 4326);
SELECT @square;

DECLARE @square GEOGRAPHY;


SET @square = GEOGRAPHY::STPolyFromText('POLYGON((0 20, 0 0, 20 0, 20 20, 0 20))', 4326);
SELECT @square;
SGBD spațial – tip date – Poligon
DECLARE @g geometry;
SET @g = geometry::STPolyFromText(
'POLYGON((0 0, 0 3, 3 3, 3 0, 0 0), (1 1, 1 2, 2 1, 1 1))',
10);
DECLARE @g geometry;
SET @g = geometry::Parse(
'POLYGON((1 0, 0 1, 1 2, 2 1, 1 0), (2 0, 1 1, 2 2, 3 1, 2 0))'
);

SET @g = @g.MakeValid();
SELECT @g.ToString();

MULTIPOLYGON (((2 0, 3 1, 2 2, 1.5 1.5, 2 1, 1.5 0.5, 2 0)),


((1 0, 1.5 0.5, 1 1, 1.5 1.5, 1 2, 0 1, 1 0)))
Interogari spatiale
46 OGC – functii pentru analize spatiale
STArea STDifference STIntersection STOverlaps
STAsBinary STDimension STIntersects STPointN
STAsText STDisjoint STIsClosed STPointOnSurface
STBoundary STDistance STIsEmpty STRelate
STBuffer STEndpoint STIsRing STSrid
STCentroid STEnvelope STIsSimple STStartPoint
STContains STEquals STIsValid STSymDifference
STConvexHull STExteriorRing STLength STTouches
STCrosses STGeometryN STNumCurves STUnion
STCurveN (geometry Data STGeometryType (geometry Data Type) STWithin
Type) STInteriorRingN STNumGeometries STX
STCurveToLine (geometry Data STNumInteriorRing STY
Type) STNumPoints
.STArea ( )

DECLARE @g geometry;
SET @g = geometry::STGeomFromText('POLYGON((0 0, 3 0, 3 3, 0 3, 0 0),(2 2, 2 1, 1 1, 1 2, 2 2))', 0);
SELECT @g.STArea();

DECLARE @g geometry;
SET @g = geometry::Parse('CURVEPOLYGON(CIRCULARSTRING(0 2, 2 0, 4 2, 4 2, 0 2))');
SELECT @g.STArea() AS Area;
.STAsBinary ( )

DECLARE @g geometry;
SET @g = geometry::STGeomFromText('LINESTRING(0 0, 2 3)', 0);
SELECT @g.STAsBinary();
.STAsText ( )

DECLARE @g geometry;
SET @g = geometry::STGeomFromText('LINESTRING(0 0, 2 3)', 0);
SELECT @g.STAsText();
.STBoundary ( )
DECLARE @g geometry;
SET @g = geometry::STGeomFromText('LINESTRING(0 0, 2 2, 0 2, 2 0)', 0);
SELECT @g.STBoundary().ToString();

DECLARE @g geometry;
SET @g = geometry::STGeomFromText('LINESTRING(0 0, 2 2, 0 2, -2 2, 0 0)', 0);
SELECT @g.STBoundary().ToString();

DECLARE @g geometry;
SET @g = geometry::STGeomFromText('CURVEPOLYGON(CIRCULARSTRING(0 0, 2 2, 0 2, -2 2, 0 0))', 0);
SELECT @g.STBoundary().ToString();
.STBuffer ( distance )
DECLARE @g geometry= 'LINESTRING(3 4, 8 11)';
SELECT @g.STBuffer(-1).ToString();

DECLARE @g geometry = 'POLYGON((1 1, 1 5, 5 5, 5 1, 1 1))';


SELECT @g.STBuffer(-1).ToString();

DECLARE @g geometry = 'CURVEPOLYGON(COMPOUNDCURVE(CIRCULARSTRING(0 4, 4 0, 8 4), (8 4, 0 4)))';


SELECT @g.STBuffer(-1).ToString();

DECLARE @g geometry = 'CURVEPOLYGON(COMPOUNDCURVE(CIRCULARSTRING(0 4, 4 0, 8 4), (8 4, 0 4)))';


SELECT @g.STBuffer(-2).ToString();

DECLARE @g geometry = 'MULTIPOINT((1 1),(1 4))';


SELECT @g.STBuffer(1).ToString();
SELECT @g.STBuffer(1.5).ToString();
SELECT @g.STBuffer(1.6).ToString();
.STCentroid ( )
DECLARE @g geometry;
SET @g = geometry::STGeomFromText('POLYGON((0 0, 3 0, 3 3, 0 3, 0 0),(2 2, 2 1, 1 1, 1 2, 2 2))', 0);
SELECT @g.STCentroid().ToString();

DECLARE @g geometry = 'CURVEPOLYGON(CIRCULARSTRING(0 4, 4 0, 8 4, 4 8, 0 4),


CIRCULARSTRING(2 4, 4 2, 6 4, 4 6, 2 4))';
SELECT @g.STCentroid().ToString() AS Centroid
.STContains ( other_geometry )
DECLARE @g geometry;
DECLARE @h geometry;
SET @g = geometry::STGeomFromText('POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))', 0);
SET @h = geometry::STGeomFromText('POINT(1 1)', 0);
SELECT @g.STContains(@h);
.STConvexHull ( )
DECLARE @g geometry;
SET @g = geometry::STGeomFromText('POLYGON((0 0, 0 2, 1 1, 2 2, 2 0, 0 0))', 0);
SELECT @g.STConvexHull().ToString();
.STCrosses ( other_geometry )

DECLARE @g geometry;
DECLARE @h geometry;
SET @g = geometry::STGeomFromText('LINESTRING(0 2, 2 0)', 0);
SET @h = geometry::STGeomFromText('LINESTRING(0 0, 2 2)', 0);
SELECT @g.STCrosses(@h);
.STCurveN ( curve_index )
DECLARE @g geometry = 'CIRCULARSTRING(0 0, 1 2.1082, 3 6.3246, 0 7, -3 6.3246, -1 2.1082, 0 0)';
SELECT @g.STCurveN(2).ToString();

DECLARE @g geometry = 'COMPOUNDCURVE(CIRCULARSTRING(0 0, 1 2.1082, 3 6.3246, 0 7, -3 6.3246, -1 2.1082, 0 0))';


SELECT @g.STCurveN(2).ToString();

DECLARE @g geometry = 'COMPOUNDCURVE (CIRCULARSTRING (0 0, 1 2.1082, 3 6.3246),


CIRCULARSTRING(3 6.3246, 0 7, -3 6.3246), CIRCULARSTRING(-3 6.3246, -1 2.1082, 0 0))';
SELECT @g.STCurveN(2).ToString();

DECLARE @g geometry;
DECLARE @n int;
SET @n = 3;
SET @g = geometry::Parse('CIRCULARSTRING(0 0, 1 2.1082, 3 6.3246, 0 7, -3 6.3246, -1 2.1082, 0 0)');
IF @n >= 1 AND @n <= @g.STNumCurves()
BEGIN
SELECT @g.STCurveN(@n).ToString();
END
.STCurveToLine ( )
DECLARE @g geometry;
SET @g = @g.STCurveToLine();
SELECT @g.STGeometryType();
SET @g = geometry::Parse('LINESTRING EMPTY');
SELECT @g.STGeometryType();

DECLARE @g geometry;
SET @g = geometry::Parse('LINESTRING(1 3, 5 5, 4 3, 1 3)');
SET @g = @g.STCurveToLine();
SELECT @g.STGeometryType();

DECLARE @g1 geometry, @g2 geometry;


SET @g1 = geometry::Parse('CIRCULARSTRING(10 0, 0 10, -10 0, 0 -10, 10 0)');
SET @g2 = @g1.STCurveToLine();
SELECT @g1.STGeometryType() AS [G1 Type], @g2.STGeometryType() AS [G2 Type], @g1.STLength() AS [G1
Perimeter], @g2.STLength() AS [G2 Perimeter], @g2.ToString() AS [G2 Def];
SELECT @g1.STNumPoints(), @g2.STNumPoints();
.STDifference ( other_geometry )
DECLARE @g geometry;
DECLARE @h geometry;
SET @g = geometry::STGeomFromText('POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))', 0);
SET @h = geometry::STGeomFromText('POLYGON((1 1, 3 1, 3 3, 1 3, 1 1))', 0);
SELECT @g.STDifference(@h).ToString();

DECLARE @g geometry = 'CURVEPOLYGON (CIRCULARSTRING (0 -4, 4 0, 0 4, -4 0, 0 -4))';


DECLARE @h geometry = 'POLYGON ((1 -1, 5 -1, 5 3, 1 3, 1 -1))';
-- Note the different results returned by the two SELECT statements
SELECT @h.STDifference(@g).ToString(), @g.STDifference(@h).ToString();
.STDimension ( )
DECLARE @temp table ([name] varchar(10), [geom] geometry);
INSERT INTO @temp values ('Point', geometry::STGeomFromText('POINT(3 3)', 0));
INSERT INTO @temp values ('LineString', geometry::STGeomFromText('LINESTRING(0 0, 3 3)', 0));
INSERT INTO @temp values ('Polygon', geometry::STGeomFromText('POLYGON((0 0, 3 0, 0 3, 0 0))', 0));
SELECT [name], [geom].STDimension() as [dim]
FROM @temp;
.STDisjoint ( other_geometry )
DECLARE @g geometry;
DECLARE @h geometry;
SET @g = geometry::STGeomFromText('LINESTRING(0 2, 2 0, 4 2)', 0);
SET @h = geometry::STGeomFromText('POINT(1 1)', 0);
SELECT @g.STDisjoint(@h);
.STDistance ( other_geometry )
DECLARE @g geometry;
DECLARE @h geometry;
SET @g = geometry::STGeomFromText('POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))', 0);
SET @h = geometry::STGeomFromText('POINT(10 10)', 0);
SELECT @g.STDistance(@h);
.STStartPoint ( )

DECLARE @g geometry;
SET @g = geometry::STGeomFromText('LINESTRING(0 0, 2 2, 1 0)', 0);
SELECT @g.STStartPoint().ToString();
.STEndPoint ( )
DECLARE @g geometry;
SET @g = geometry::STGeomFromText('LINESTRING(0 0, 2 2, 1 0)', 0);
SELECT @g.STEndPoint().ToString();
STEnvelope ( )
DECLARE @g geometry;
SET @g = geometry::STGeomFromText('LINESTRING(0 0, 2 3)', 0);
SELECT @g.STEnvelope().ToString();
.STEquals ( other_geometry )
DECLARE @g geometry
DECLARE @h geometry;
SET @g = geometry::STGeomFromText('LINESTRING(0 2, 2 0, 4 2)', 0);
SET @h = geometry::STGeomFromText('MULTILINESTRING((4 2, 2 0), (0 2, 2 0))', 0);
SELECT @g.STEquals(@h);
.STExteriorRing ( )
DECLARE @g geometry;
SET @g = geometry::STGeomFromText('POLYGON((0 0, 3 0, 3 3, 0 3, 0 0),(2 2, 2 1, 1 1, 1 2, 2 2))', 0);
SELECT @g.STExteriorRing().ToString();
.STGeometryN ( expression )
DECLARE @g geometry;
SET @g = geometry::STGeomFromText('MULTIPOINT(0 0, 13.5 2, 7 19)', 0);
SELECT @g.STGeometryN(2).ToString();
.STGeometryType ( )

DECLARE @g geometry;
SET @g = geometry::STGeomFromText('POLYGON((0 0, 3 0, 3 3, 0 3, 0 0))', 0);
SELECT @g.STGeometryType();
.STInteriorRingN ( expression )

DECLARE @g geometry;
SET @g = geometry::STGeomFromText('POLYGON((0 0, 3 0, 3 3, 0 3, 0 0),(2 2, 2 1, 1 1, 1 2, 2 2))', 0);
SELECT @g.STInteriorRingN(1).ToString();
.STIntersection ( other_geometry )
SRIDs
DECLARE @g geometry;
DECLARE @h geometry;
SET @g = geometry::STGeomFromText('POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))', 0);
SET @h = geometry::STGeomFromText('POLYGON((1 1, 3 1, 3 3, 1 3, 1 1))', 0);
SELECT @g.STIntersection(@h).ToString();

DECLARE @g geometry = 'CURVEPOLYGON (CIRCULARSTRING (0 -4, 4 0, 0 4, -4 0, 0 -4))';


DECLARE @h geometry = 'POLYGON ((1 -1, 5 -1, 5 3, 1 3, 1 -1))';
SELECT @h.STIntersection(@g).ToString();
.STIntersects ( other_geometry )

DECLARE @g geometry;
DECLARE @h geometry;
SET @g = geometry::STGeomFromText('LINESTRING(0 2, 2 0, 4 2)', 0);
SET @h = geometry::STGeomFromText('POINT(1 1)', 0);
SELECT @g.STIntersects(@h);
.STIsClosed ( )

DECLARE @g geometry;
SET @g = geometry::STGeomFromText('LINESTRING(0 0, 2 2, 1 0)', 0);
SELECT @g.STIsClosed();
.STIsEmpty ( )

DECLARE @g geometry;
SET @g = geometry::STGeomFromText('POLYGON EMPTY', 0);
SELECT @g.STIsEmpty();
.STIsRing ( )

DECLARE @g geometry;
SET @g = geometry::STGeomFromText('LINESTRING(0 0, 2 2, 1 0, 0 0)', 0);
SELECT @g.STIsRing();
.STIsSimple ( )

DECLARE @g geometry;
SET @g = geometry::STGeomFromText('LINESTRING(0 0, 2 2, 0 2, 2 0)', 0);
SELECT @g.STIsSimple();
.STIsValid ( )

DECLARE @g geometry;
SET @g = geometry::STGeomFromText('LINESTRING(0 0, 2 2, 1 0)', 0);
SELECT @g.STIsValid();
.STLength ( )

DECLARE @g geometry;
SET @g = geometry::STGeomFromText('LINESTRING(0 0, 2 2, 1 0)', 0);
SELECT @g.STLength();
.STNumCurves()

DECLARE @g geometry;
SET @g = geometry::Parse('CIRCULARSTRING(10 0, 0 10, -10 0, 0 -10, 10 0)');
SELECT @g.STNumCurves();

DECLARE @g geometry;
SET @g = geometry::Parse('COMPOUNDCURVE(CIRCULARSTRING(10 0, 0 10, -10 0, 0 -10, 10 0))');
SELECT @g.STNumCurves();
.STNumInteriorRing ( )

DECLARE @g geometry;
SET @g = geometry::STGeomFromText('POLYGON((0 0, 3 0, 3 3, 0 3, 0 0),(2 2, 2 1, 1 1, 1 2, 2 2))', 0);
SELECT @g.STNumInteriorRing();
.STNumPoints ( )

DECLARE @g geometry;
SET @g = geometry::STGeomFromText('LINESTRING(0 0, 2 2, 1 0)', 0);
SELECT @g.STNumPoints();
.STOverlaps ( other_geometry )

DECLARE @g geometry;
DECLARE @h geometry;
SET @g = geometry::STGeomFromText('POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))', 0);
SET @h = geometry::STGeomFromText('POLYGON((1 1, 3 1, 3 3, 1 3, 1 1))', 0);
SELECT @g.STOverlaps(@h);
.STPointN ( expression )

DECLARE @g geometry;
SET @g = geometry::STGeomFromText('LINESTRING(0 0, 2 2, 1 0)', 0);
SELECT @g.STPointN(2).ToString();
.STPointOnSurface ( )

DECLARE @g geometry;
SET @g = geometry::STGeomFromText('POLYGON((0 0, 3 0, 3 3, 0 3, 0 0),(2 2, 2 1, 1 1, 1 2, 2 2))', 0);
SELECT @g.STPointOnSurface().ToString();
.STRelate ( other_geometry,
intersection_pattern_matrix )

DECLARE @g geometry;
DECLARE @h geometry;
SET @g = geometry::STGeomFromText('LINESTRING(0 2, 2 0, 4 2)', 0);
SET @h = geometry::STGeomFromText('POINT(5 5)', 0);
SELECT @g.STRelate(@h, 'FF*FF****');
STSrid

DECLARE @g geometry;
SET @g = geometry::STGeomFromText('POLYGON((0 0, 3 0, 3 3, 0 3, 0 0))', 13);
SELECT @g.STSrid;

SET @g.STSrid = 23;


SELECT @g.STSrid;
.STSymDifference ( other_geometry )
DECLARE @g geometry;
DECLARE @h geometry;
SET @g = geometry::STGeomFromText('POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))', 0);
SET @h = geometry::STGeomFromText('POLYGON((1 1, 3 1, 3 3, 1 3, 1 1))', 0);
SELECT @g.STSymDifference(@h).ToString();

DECLARE @g geometry = 'CURVEPOLYGON (CIRCULARSTRING (0 -4, 4 0, 0 4, -4 0, 0 -4))';


DECLARE @h geometry = 'POLYGON ((1 -1, 5 -1, 5 3, 1 3, 1 -1))';
SELECT @h.STSymDifference(@g).ToString();

DECLARE @g geometry = 'CURVEPOLYGON (CIRCULARSTRING (0 -4, 4 0, 0 4, -4 0, 0 -4))';


DECLARE @h geometry = 'POLYGON ((1 -1, 2 -1, 2 1, 1 1, 1 -1))';
SELECT @h.STSymDifference(@g).ToString();
.STTouches ( other_geometry )

DECLARE @g geometry;
DECLARE @h geometry;
SET @g = geometry::STGeomFromText('LINESTRING(0 2, 2 0, 4 2)', 0);
SET @h = geometry::STGeomFromText('POINT(1 1)', 0);
SELECT @g.STTouches(@h);
.STUnion ( other_geometry )
DECLARE @g geometry;
DECLARE @h geometry;
SET @g = geometry::STGeomFromText('POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))', 0);
SET @h = geometry::STGeomFromText('POLYGON((1 1, 3 1, 3 3, 1 3, 1 1))', 0);
SELECT @g.STUnion(@h).ToString();

DECLARE @g geometry = 'CURVEPOLYGON(CIRCULARSTRING(0 -4, 4 0, 0 4, -4 0, 0 -4))';


DECLARE @h geometry = 'POLYGON((5 -1, 5 -3, 7 -3, 7 -1, 5 -1))';
SELECT @g.STUnion(@h).ToString();
.STWithin ( other_geometry )

DECLARE @g geometry;
DECLARE @h geometry;
SET @g = geometry::STGeomFromText('POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))', 0);
SET @h = geometry::STGeomFromText('POLYGON((1 1, 3 1, 3 3, 1 3, 1 1))', 0);
SELECT @g.STWithin(@h);
.STX

DECLARE @g geometry;
SET @g = geometry::STGeomFromText('POINT(3 8)', 0);
SELECT @g.STX;
ArcGIS Pro
ArcGIS Pro

• Vizualizare și cartografiere
ArcGIS Pro • Analiză date
• Automatizări
• Editare și administrare de date
• Procesare imagini
• Inteligență artificială
• Dezvoltare (addin, etc)
Mod de licențiere

Utilizatori în
cloud
Licențiere
Licențiere
pe
concurentă
calculator
ArcGIS Pro
Proiect ArcGIS Pro

Structură proiect ArcGIS Pro


Hărți și scene Instrumente Geocodare

Baze date Dosare Imprimare hărți


Simbolizare date geografice
Simbolizare
Tipuri de simbolizări
Unique values

Default symbology

Graduated colors
Tipuri de simbolizări Graduated symbols

Default symbology

Heat map

Clustering
Diferențe dintre tipuri de simbolizări / tip de
date
Simbolizare – intervale de valori
Single symbol

Natural breaks (Jenks) Quantile Equal interval


Etichetare date geografice
Caracteristici straturi tematice
• Strat individual UAT Nume UAT
• Afișare dinamică
• Modificare etichetă
Etichete - clase

• Camping existent

• Camping propus
Vizualizare 3D
Capabilități 3D

Vizualizare Administrare

Partajare Analiză
Scene locale și globale
Local
Scene locale și globale
• Global
Analiză spațială
Flux de lucru – analiză spațială
Identificare
cerințe

Explorare/
Decizie pregătire
date

Diseminare Analiză și
rezultate modelare

Modificare Interpretare
/Ajustare rezultate
Tip de analize - exemple
• Obiecte localizate în vecinătate
• Cel mai apropriat obiect
• Distanțe
• Suprapuneri
• Analiză schimbare
• Traseu optim
• etc
Tip de analize - exemple
• Selectare spațială
Obiective economice din zona inundabilă
Tip de analize - exemple
• Analiză de proximitate
Unități bancare
Zona tampon de 1km
Tip de analize - exemple
• Extragere suprafețe comune

A B A
Tip de analize - exemple
• Suprapunere

A
A B &
B
Instrumente de geoprocesare
Conversion Data Analysis
Management
Conversion
Feature Class To Add Field Clip
Feature Class

Create File Intersect


Feature Class to Geodatabase
Geodatabase
Buffer
Table To Table Package Map

Enrich
Automatizare
Automatizare analiză
ModelBuilder

Tasks Python
Ce este Model Builder?
Vizualizare flux de lucru

Înlănțuire instrumente de geoprocesare


Elemente principale Model Builder
Ce permite Model Builder?
Modificare de parametrii și relansarea analiză
Ce permite Model Builder?
Salvarea modelelor de analiză și partajarea lor
Imprimare hărți
Hărți tematice
Imprimare hartă
• Titlu
• Orientare
• Medalioane
• Scara grafică și/sau numerică
• Direcția nord
• Legendă
Imprimare hartă - exemplu
Instrumente pentru analiza
spațială
Instrumente de analiza spatiala

Clip
Instrumente de analiza spatiala

Split
Instrumente de analiza spatiala

Apportion Polygon
Instrumente de analiza spatiala

Count Overlapping Features


Instrumente de analiza spatiala

Erase
Instrumente de analiza spatiala

Identify
Instrumente de analiza spatiala

Intersect
Instrumente de analiza spatiala

Symmetrical Difference
Instrumente de analiza spatiala

Union
Instrumente de analiza spatiala

Update
Instrumente de analiza spatiala

Update
Instrumente de analiza spatiala

Buffer
Instrumente de analiza spatiala

Buffer
Instrumente de analiza spatiala

Buffer
Instrumente de analiza spatiala

Dissolve
Instrumente de analiza spatiala

Integrate
Instrumente de analiza spatiala

Thiessen/Voronoi
Instrumente de analiza spatiala

Near
Instrumente de analiza spatiala

Origin-Destination Links
Instrumente de analiza spatiala

Polygon neighbors
Instrumente de analiza spatiala

Enrich
Instrumente de analiza spatiala

Summarize Nearby Summarize Within

Tabulate Intersection
Introducere in dezvoltare de
instrumente de analiza utilizand
ArcPy
Python-Conda-Anaconda si ArcGIS Pro

https://www.esri.com/arcgis-blog/products/api-python/administration/python-api-core-concepts-part-2/
Python-Conda-Anaconda si ArcGIS Pro

https://www.esri.com/arcgis-blog/products/api-python/administration/python-api-core-concepts-part-2/
Python-Conda-Anaconda si ArcGIS Pro

https://www.esri.com/arcgis-blog/products/api-python/administration/python-api-core-concepts-part-2/
ArcPy
• ArcPy este o biblioteca de Python care oferă o modalitate utilă și
productivă de a efectua analiza datelor geografice, conversia datelor,
gestionarea datelor și automatizarea hărților.
• https://pro.arcgis.com/en/pro-app/latest/arcpy/get-started/what-is-
arcpy-.htm
ArcPy Module

https://pro.arcgis.com/en/pro-app/latest/arcpy/get-started/a-quick-tour-of-arcpy.htm
ArcPy
ArcPy
ArcPy
ArcPy
ArcPy
arcpy.da.InsertCursor(in_table, field_names) Inserts rows

arcpy.da.SearchCursor(in_table, field_names,
{where_clause}, {spatial_reference}, {explode_to_points}, Read-only access
{sql_clause})

arcpy.da.UpdateCursor(in_table, field_names,
{where_clause}, {spatial_reference}, {explode_to_points}, Updates or deletes rows
{sql_clause})
ArcPy
ArcPy
import arcpy

fc = 'c:/data/base.gdb/well’
fields = ['WELL_ID', 'WELL_TYPE’]

for row in sorted(arcpy.da.SearchCursor(fc, fields)):


print(u'{0}, {1}'.format(row[0], row[1]))

for row in arcpy.da.SearchCursor( fc, fields, sql_clause=(None, 'ORDER BY WELL_ID,


WELL_TYPE')):
print(u'{0}, {1}'.format(row[0], row[1]))

for row in arcpy.da.SearchCursor(fc, fields, sql_clause=('TOP 3', None)):


print(u'{0}, {1}'.format(row[0], row[1]))
ArcPy
ArcPy
import arcpy

arcpy.env.workspace = 'c:/data/output.gdb' fc = 'c:/data/base.gdb/roads'


fields = ['ROAD_TYPE', 'BUFFER_DISTANCE’]

# Create update cursor for feature class


with arcpy.da.UpdateCursor(fc, fields) as cursor:
for row in cursor:
row[1] = row[0] * 100
cursor.updateRow(row)

arcpy.Buffer_analysis(fc, 'roads_buffer', 'BUFFER_DISTANCE')


ArcPy - Insert
ArcPy - Insert
import arcpy

# Create a polyline geometry


array = arcpy.Array([arcpy.Point(459111.6681, 5010433.1285),

arcpy.Point(472516.3818, 5001431.0808), arcpy.Point(477710.8185,


4986587.1063)])

polyline = arcpy.Polyline(array)
# Open an InsertCursor and insert the new geometry

cursor = arcpy.da.InsertCursor('C:/data/texas.gdb/counties', ['SHAPE@'])


cursor.insertRow([polyline])

# Delete cursor object


del cursor
ArcPy
ArcPy – accesare geometrii
The Esri JSON string
SHAPE@JSON representing the
geometry.
A geometry object for The well-known binary
SHAPE@ (WKB) representation for
the feature.
A tuple of the feature's OGC geometry. It
SHAPE@XY provides a portable
centroid x,y coordinates. SHAPE@WKB
representation of a
A tuple of the feature's geometry value as a
centroid x,y coordinates. contiguous stream of
SHAPE@TRUECENTROID
This returns the same bytes.
value as SHAPE@XY.
The well-known text
A double of the feature's
SHAPE@X (WKT) representation for
x-coordinate. OGC geometry. It
A double of the feature's SHAPE@WKT provides a portable
SHAPE@Y
y-coordinate. representation of a
A double of the feature's geometry value as a text
SHAPE@Z
z-coordinate. string.
A double of the feature's A double of the feature's
SHAPE@M SHAPE@AREA
m-value. area.
A double of the feature's
SHAPE@LENGTH
length.
ArcPy – accesare geometrii
import arcpy

infc = arcpy.GetParameterAsText(0)

for row in arcpy.da.SearchCursor(infc, ["SHAPE@XY"]):


x, y = row[0] print("{}, {}".format(x, y))
ArcPy – accesare geometrii
import arcpy
infc = arcpy.GetParameterAsText(0)

for row in arcpy.da.SearchCursor(infc, ["OID@", "SHAPE@"]):


print("Feature {}:".format(row[0]))
for pnt in row[1]:
print("{}, {}".format(pnt.X, pnt.Y))
ArcPy – accesare geometrii
import arcpy

infc = arcpy.GetParameterAsText(0)

for row in arcpy.da.SearchCursor(infc, ["OID@", "SHAPE@"]):


print("Feature {}:".format(row[0]))
partnum = 0
for part in row[1]:
print("Part {}:".format(partnum))
for pnt in part:
if pnt:
print("{}, {}".format(pnt.X, pnt.Y))
else:
print("Interior Ring:")
partnum += 1
ArcPy – scriere geometrii
import arcpy

fc = "c:/data/gdb.gdb/roads"

cursor = arcpy.da.InsertCursor(fc, ["SHAPE@"])

array = arcpy.Array([arcpy.Point(-77.4349451, 37.5408265), arcpy.Point(-


78.6384349, 35.7780943)])

spatial_reference = arcpy.SpatialReference(4326)

polyline = arcpy.Polyline(array, spatial_reference)

cursor.insertRow([polyline])
ArcPy – scriere geometrii
first_part = arcpy.Array([arcpy.Point(-77.4349451, 37.5408265), arcpy.Point(-
78.6384349, 35.7780943)])

second_part = arcpy.Array([arcpy.Point(-79.7910143, 36.0786785), arcpy.Point(-


80.8546435, 35.2315402)])

array = arcpy.Array([first_part, second_part])

spatial_reference = arcpy.SpatialReference(4326)

multipart_feature = arcpy.Polyline(array, spatial_reference)

cursor.insertRow([multipart_feature])
ArcPy – scriere geometrii
import arcpy
import os
coords_list = [[1, -61845879.0968, 45047635.4861], [1, -3976119.96791,
46073695.0451], [1, 1154177.8272, -25134838.3511], [1, -62051091.0086, -
26160897.9101], [2, 17365918.8598, 44431999.7507], [2, 39939229.1582,
45252847.3979], [2, 41170500.6291, 27194199.1591], [2, 17981554.5952,
27809834.8945], [3, 15519011.6535, 11598093.8619], [3, 52046731.9547,
13034577.2446], [3, 52867579.6019, -16105514.2317], [3, 17160706.948, -
16515938.0553]]
outFC = arcpy.GetParameterAsText(0)
template = arcpy.GetParameterAsText(1)
cursor = None
ArcPy – scriere geometrii
try:
arcpy.CreateFeatureclass_management(os.path.dirname(outFC),
os.path.basename(outFC), "POLYLINE", template)
spatial_reference = arcpy.Describe(template).spatialReference
cursor = arcpy.da.InsertCursor(outFC, ["SHAPE@"])
array = arcpy.Array()
ID = -1
for coords in coords_list:
if ID == -1:
ID = coords[0]
if ID != coords[0]:
cursor.insertRow([arcpy.Polyline(array)])
array.removeAll()
array.add(arcpy.Point(coords[1], coords[2], ID=coords[0]))
ID = coords[0]
polyline = arcpy.Polyline(array, spatial_reference)
cursor.insertRow([polyline])
except Exception as e:
print(e)
finally:
if cursor:
del cursor
ArcPy – Python toolbox
• O colectie de instrumente Python utilizate pentru analiza datelor GIS
• Foloseste programarea orientate obiect
• Un fisier text cu extensia PYT
• In esenta, cod de Python – clase sablon
ArcPy – Python toolbox
Partajare hărți

ArcGIS Online
• Servicii WebGIS
• Hărți dinamice
Pachete/Fișiere Imagine/Servicii • Pachete de date sau analiză
Tipuri de servicii WebGIS

OGC ESRI
- Web Map Service - MapService
- Web Map Tile Service - MapService Cache
- Web Feature Service - FeatureService
- Web Coverage Service - ImageService
- Web Processing Service - GeoprocessingService
- Other … - Other..
Tipuri de servicii WebGIS - WMS
WMS
http://host[:port]/path[?{name[=value]&}] https://www.geo-spatial.org/geoserver/gwc/service/wms?
name=value&

MapService
http://host[:port]/path[?{name[=value]&}] https://eism.geo-
name=value& spatial.ro/eismgeo/rest/directories/arcgisoutput/Patrimoniu/
PatrimoniuWM_MapServer
Tipuri de servicii WebGIS - WMS
WMS
https://www.geo-spatial.org/geoserver/gwc/service/wms?
- service=WMS&
- request=GetMap&
- layers=eharta:mozaic_planuri_tragere_20k&
- styles=&
- format=image/png&
- transparent=true&
- version=1.1.1&
- width=256&
- height=256&
- srs=EPSG:3857&
- bbox=2817774.6107047377,5635549.221409476,3130860.6785608195,5948635.289265557
Tipuri de servicii WebGIS - MapServer
MapServer
https://eism.geo-spatial.ro/eismgeo/rest/services/Patrimoniu/PatrimoniuWM/MapServer/export?
- bbox=2683538.351578484,5928094.489662885,2801525.8479150273,5768111.443782827&
- size=649,880&
- dpi=96&
- format=png24&
- transparent=true&
- bboxSR=3857&
- imageSR=3857&
- layers=show:0
Tipuri de servicii WebGIS - WFS
WFS
https://geobretagne.fr/geoserver/ows?
- SERVICE=WFS&
- REQUEST=GetCapabilities&
- VERSION=2.0.0

https://geobretagne.fr/geoserver/wfs?
- SERVICE=WFS&
- REQUEST=DescribeFeatureType&
- VERSION=2.0.0&
- TYPENAME=fma:bvme_zhp_vs_transport

https://geobretagne.fr/geoserver/wfs?
- SERVICE=WFS&
- REQUEST=GetFeature&
- VERSION=2.0.0&
- TYPENAMES=fma:bvme_zhp_vs_transport&
- OUTPUTFORMAT=json&
- SRSNAME=EPSG:4326
Tipuri de servicii WebGIS - FeatureServer
FeatureServer
https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0?
- f=json

Protocol Buffer Specifications


https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0/query?
- f=pbf&
- cacheHint=true&
- maxRecordCountFactor=4&
- resultOffset=0&
- resultRecordCount=8000&
- where=1=1&
- orderByFields=FID&
- outFields=C_Storage,FID&
- outSR=102100&
- spatialRel=esriSpatialRelIntersects
Tipuri de servicii WebGIS - FeatureServer

https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0/query?
- f=json&
- cacheHint=true&
- maxRecordCountFactor=4&
- resultOffset=0&
- resultRecordCount=8000&
- where=1=1&
- orderByFields=FID&
- outFields=C_Storage,FID&
- outSR=102100&
- spatialRel=esriSpatialRelIntersects

S-ar putea să vă placă și