MULTILINESTRING MULTILINESTRING((11 5, 7 4, 3 9), (5 3, 2 7, 6 5)) MULTIPOLYGON MULTIPOLYGON(((0 0, 5 5, 10 0, 0 0)), ((3 2, 5 1, 7 2, 3 2)))



Podobne dokumenty
DANE PRZESTRZENNE W BAZACH DANYCH SYSTEMU MICROSOFT SQL SERVER 2008 R2 WPROWADZENIE

Charakterystyka przestrzennych typów danych. do tworzenia raportów. Using spatial data types in reports.

Przestrzenne bazy danych PostGIS

Przestrzenne bazy danych. Funkcje geometryczne

Multimedialne bazy danych. Andrzej Łachwa, WFAiIS UJ 2011

Przestrzenne bazy danych. Wstęp do przestrzennych baz danych

Innowacyjne rozwiązania typu open source w aplikacjach typu gis-web. Dominik Tałanda

Przestrzenne bazy danych. Typy obiektów przestrzennych

Przestrzenne bazy danych. Funkcje relacji przestrzennych

Przestrzenne bazy danych. Definicja i cechy przestrzennych baz danych

Zakopane, plan miasta: Skala ok. 1: = City map (Polish Edition)

Stargard Szczecinski i okolice (Polish Edition)

PROJEKTOWANIE BAZ DANYCH Z WYKORZYSTANIEM NIERELACYJNYCH TYPÓW DANYCH

MaPlan Sp. z O.O. Click here if your download doesn"t start automatically

KOLEKCJE - to typy masowe,zawierające pewną liczbę jednorodnych elementów

Programowanie w SQL procedury i funkcje. UWAGA: Proszę nie zapominać o prefiksowaniu nazw obiektów ciągiem [OLIMP\{nr indeksu}] Funkcje użytkownika

Hard-Margin Support Vector Machines

3. Standaryzacja modeli danych przestrzennych

Testy jednostkowe - zastosowanie oprogramowania JUNIT 4.0 Zofia Kruczkiewicz

Oracle PL/SQL. Paweł Rajba.

strukturalny język zapytań używany do tworzenia i modyfikowania baz danych oraz do umieszczania i pobierania danych z baz danych

Wojewodztwo Koszalinskie: Obiekty i walory krajoznawcze (Inwentaryzacja krajoznawcza Polski) (Polish Edition)

Installation of EuroCert software for qualified electronic signature

Wojewodztwo Koszalinskie: Obiekty i walory krajoznawcze (Inwentaryzacja krajoznawcza Polski) (Polish Edition)

Miedzy legenda a historia: Szlakiem piastowskim z Poznania do Gniezna (Biblioteka Kroniki Wielkopolski) (Polish Edition)

Funkcje w PL/SQL Funkcja to nazwany blok języka PL/SQL. Jest przechowywana w bazie i musi zwracać wynik. Z reguły, funkcji utworzonych w PL/SQL-u

Sprawdzenie poziomu izolacji transakcji (w aktualnym połączeniu):

Karpacz, plan miasta 1:10 000: Panorama Karkonoszy, mapa szlakow turystycznych (Polish Edition)

Marzec: food, advertising, shopping and services, verb patterns, adjectives and prepositions, complaints - writing

Tychy, plan miasta: Skala 1: (Polish Edition)

Pielgrzymka do Ojczyzny: Przemowienia i homilie Ojca Swietego Jana Pawla II (Jan Pawel II-- pierwszy Polak na Stolicy Piotrowej) (Polish Edition)

Emilka szuka swojej gwiazdy / Emily Climbs (Emily, #2)

Bazy danych 10. SQL Widoki

1. Wstęp ELŻBIETA BIELECKA

ARNOLD. EDUKACJA KULTURYSTY (POLSKA WERSJA JEZYKOWA) BY DOUGLAS KENT HALL

Wojewodztwo Koszalinskie: Obiekty i walory krajoznawcze (Inwentaryzacja krajoznawcza Polski) (Polish Edition)

Instrukcja konfiguracji usługi Wirtualnej Sieci Prywatnej w systemie Mac OSX

Tworzenie tabel. Bazy danych - laboratorium, Hanna Kleban 1

Rozpoznawanie twarzy metodą PCA Michał Bereta 1. Testowanie statystycznej istotności różnic między jakością klasyfikatorów

Katowice, plan miasta: Skala 1: = City map = Stadtplan (Polish Edition)

SQL 4 Structured Query Lenguage

ELF. system: pokój młodzieżowy / teenagers room MEBLE MŁODZIEŻOWE / YOUTH ROOM FURNITURE ELF

An employer s statement on the posting of a worker to the territory of the Republic of Poland

Systemowe aspekty baz

GIS i dane geograficzne w bazach relacyjnych

Wykład 2 Układ współrzędnych, system i układ odniesienia

1945 (96,1%) backlinks currently link back (74,4%) links bear full SEO value. 0 links are set up using embedded object

Dane przestrzenne w relacyjnych bazach danych

Zasady transformacji modelu DOZ do projektu tabel bazy danych

Weronika Mysliwiec, klasa 8W, rok szkolny 2018/2019

Zmiany techniczne wprowadzone w wersji Comarch ERP Altum

GIS i dane geograficzne w bazach relacyjnych

ZAPIS PLIKÓW GRAFIKI WEKTOROWEJ DO BAZY DANYCH MS SQL

Autor: Joanna Karwowska

Oracle PL/SQL. Paweł Rajba.

Miedzy legenda a historia: Szlakiem piastowskim z Poznania do Gniezna (Biblioteka Kroniki Wielkopolski) (Polish Edition)

y = The Chain Rule Show all work. No calculator unless otherwise stated. If asked to Explain your answer, write in complete sentences.

Wykład 5. SQL praca z tabelami 2

Autor: Joanna Karwowska

Obsługa błędów w SQL i transakcje. Obsługa błędów w SQL

Bazy danych. Bazy danych. Zapytania SELECT. Dr inż. Paweł Kasprowski.

Bardzo formalny, odbiorca posiada specjalny tytuł, który jest używany zamiast nazwiska

Karpacz, plan miasta 1:10 000: Panorama Karkonoszy, mapa szlakow turystycznych (Polish Edition)

Pobieranie argumentów wiersza polecenia

GIS STRUKTURY DANYCH RELACJE PRZESTRZENNE.

- język zapytań służący do zapisywania wyrażeń relacji, modyfikacji relacji, tworzenia relacji

Shapefile, GeoPackage czy PostGIS. Marta Woławczyk (QGIS Polska)

Systemy baz danych Prowadzący: Adam Czyszczoń. Systemy baz danych. 1. Import bazy z MS Access do MS SQL Server 2012:

Zarządzanie sieciami komputerowymi - wprowadzenie

OpenPoland.net API Documentation

Funkcjonalność systemów zarządzania bazami danych przestrzennych w kartografii internetowej (PosrtgreSQL/PostGIS) Krzysztof Kuśnierek

EXAMPLES OF CABRI GEOMETRE II APPLICATION IN GEOMETRIC SCIENTIFIC RESEARCH

STAŁE TRASY LOTNICTWA WOJSKOWEGO (MRT) MILITARY ROUTES (MRT)

Zarządzanie sieciami telekomunikacyjnymi

Machine Learning for Data Science (CS4786) Lecture11. Random Projections & Canonical Correlation Analysis

Wprowadzenie do projektowania i wykorzystania baz danych Relacje

Hakin9 Spam Kings FREEDOMTECHNOLOGYSERVICES.CO.UK

Programowanie w Ruby

Procedury wyzwalane. (c) Instytut Informatyki Politechniki Poznańskiej 1

Struktura bazy danych

Kolekcje Zbiory obiektów, rodzaje: tablica o zmiennym rozmiarze (ang. varray) (1) (2) (3) (4) (5) Rozszerzenie obiektowe w SZBD Oracle

Karpacz, plan miasta 1:10 000: Panorama Karkonoszy, mapa szlakow turystycznych (Polish Edition)

Domy inaczej pomyślane A different type of housing CEZARY SANKOWSKI

Helena Boguta, klasa 8W, rok szkolny 2018/2019

Cele. Definiowanie wyzwalaczy

Poniżej moje uwagi po zapoznaniu się z prezentowanymi zasadami:

Ćwiczenia laboratoryjne nr 11 Bazy danych i SQL.

ERASMUS + : Trail of extinct and active volcanoes, earthquakes through Europe. SURVEY TO STUDENTS.

Network Services for Spatial Data in European Geo-Portals and their Compliance with ISO and OGC Standards

Ustawienie na poziomie sesji (działa do zmiany lub zakończenia sesji zamknięcia połączenia).

FIGURY I PRZEKSZTAŁCENIA GEOMETRYCZNE

PODSTAWY BAZ DANYCH 13. PL/SQL

Wojewodztwo Koszalinskie: Obiekty i walory krajoznawcze (Inwentaryzacja krajoznawcza Polski) (Polish Edition)

Relacyjne bazy danych a XML

METHOD 2 -DIAGNOSTIC OUTSIDE

Ćwiczenia 2 IBM DB2 Data Studio

How to share data from SQL database table to the OPC Server? Jak udostępnić dane z tabeli bazy SQL do serwera OPC? samouczek ANT.

DMX DMX DMX DMX: CREATE MINING STRUCTURE. Tadeusz Pankowski

ABOUT NEW EASTERN EUROPE BESTmQUARTERLYmJOURNAL

Tworzenie widoku CREATE OR REPLACE VIEW [nazwa_widoku] AS SELECT [nazwy_kolumn] FROM [nazwa_tablicy];

Transkrypt:

TYP Ilustracja Przykład Typy danych POINT POINT(5 7) MULTIPOINT MULTIPOINT(4 7, 11 5, 9 12, 8 8) LINESTRING LINESTRING(5 6, 7 8, 11 3) MULTILINESTRING MULTILINESTRING((11 5, 7 4, 3 9), (5 3, 2 7, 6 5)) POLYGON POLYGON((8 3, 8 8, 12 3, 8 3)) MULTIPOLYGON MULTIPOLYGON(((0 0, 5 5, 10 0, 0 0)), ((3 2, 5 1, 7 2, 3 2))) GEOMETRYCOLLECTION GEOMETRYCOLLECTION(POINT (5 7), MULTIPOINT(4 7, 11 5, 9 12, 8 8), LINESTRING(5 6, 7 8, 11 3), MULTILINESTRING((11 5, 7 4, 3 9), (5 3, 2 7, 6 5)), POLYGON((8 3, 8 8, 12 3, 8 3)), MULTIPOLYGON(((0 0, 5 5, 10 0, 0 0)), ((3 2, 5 1, 7 2, 3 2))))

SRID The spatial reference identification system is defined by the European Petroleum Survey Group (EPSG) standard, which is a set of standards developed for cartography, surveying, and geodetic data storage. This standard is owned by the Oil and Gas Producers (OGP) Surveying and Positioning Committee. Every spatial object has a Spatial Reference ID (SRID) The SRID defines the coordinate system and datum Each object can have a different SRID, but usually doesn t (difficult to work with) Operation between objects require them to have the same SRID To see what SRIDs are supported : -- < List of Spatial Reference Systems supported in SQL 2008 >-- SELECT * FROM SYS.SPATIAL_REFERENCE_SYSTEMS Most common SRID for Geography is 4326 (also referred to as WGS84) The Default SRID for geometry is 0 For a more background on SRID's see: Wikipedia - SRID article I posted with the assistance of Ed Katibah Property.STSrid Read or Change the SRID of a spatial object. Think before changing the SRID of an existing object, understand what it means, as it is typically not a good idea. More info For more info see SQL Server 2008 Books Online Geography Spatial Type & Geometry Spatial Type

spatia l_refe rence _id SELECT * FROM SYS.SPATIAL_REFERENCE_SYSTEMS author ity_na me authoriz ed_spati al_refer ence_id well_known_text unit_of_ measure unit_co nversio n_facto r 4120 EPSG 4120 GEOGCS["Greek", DATUM["Greek", ELLIPSOID["Bessel 1841", 6377397.155, 299.1528128]], PRIMEM["Greenwich", 0], UNIT["Degree", 0.0174532925199433]] metre 1 DOMYSLNIE DLA GEOGRAPHY 4326 EPSG 4326 GEOGCS["WGS 84", DATUM["World Geodetic System 1984", ELLIPSOID["WGS 84", 6378137, 298.257223563]], PRIMEM["Greenwich", 0], UNIT["Degree", 0.0174532925199433]] metre 1

Metody tworzenia danych Spatial STGeomFromText (geometry Data Type) STPointFromText (geometry Data Type) STLineFromText (geometry Data Type) STPolyFromText (geometry Data Type) STMPointFromText (geometry Data Type) STMLineFromText (geometry Data Type) STMPolyFromText (geometry Data Type) STGeomCollFromText (geometry Data Type) STGeomFromWKB (geometry Data Type) STPointFromWKB (geometry Data Type) STLineFromWKB (geometry Data Type) STPolyFromWKB (geometry Data Type) STMPointFromWKB (geometry Data Type) STMLineFromWKB (geometry Data Type) STMPolyFromWKB (geometry Data Type) STGeomCollFromWKB (geometry Data Type)

Spatial Data deklaracja zmiennych DECLARE @tmp geometry; DECLARE @tmp2 geometry; DECLARE @result geometry; Lub DECLARE @tmp geometry= współrzędne polygonu, linii, itd..

DECLARE @e geometry; DECLARE @a geometry; DECLARE @b geometry; DECLARE @c geometry; DECLARE @d geometry; Przykłady tworzenia SET @a = geometry::stgeomfromtext('point(5 7)', 0); SET @b = geometry::stgeomfromtext('multipoint(4 7, 11 5, 9 12, 8 8)', 0); SET @c = geometry::stgeomfromtext('linestring(5 6, 7 8, 11 3)', 0); SET @d = geometry::stgeomfromtext('multilinestring((11 5, 7 4, 3 9), (5 3, 2 7, 6 5))', 0); SET @e = geometry::stgeomfromtext('polygon((8 3, 8 8, 12 3, 8 3))', 0); SET @f = geometry::stgeomfromtext('multipolygon(((0 0, 5 5, 10 0, 0 0)), ((3 2, 5 1, 7 2, 3 2)))', 0); SELECT @a SELECT @b SELECT @c SELECT @d SELECT @e Musi być ponieważ dla geometrii nie można używać dyrektywy DISTINCT wykonywanej niejawnie gdy tylko UNION

DECLARE @e geometry; DECLARE @i geometry; Nowe obiekty geometry od MS 2012 ALTER DATABASE BazaRelacyja SET Compatibility_Level=110 SET @e = geometry::stgeomfromtext('circularstring(0 0, 0 5, 5 5, 5 0, 0 0)', 0); SET @f = geometry::stgeomfromtext('curvepolygon(circularstring(10 10, 10 5, 5 5, 5 10, 10 10))', 0); SET @g = geometry::stgeomfromtext('curvepolygon(circularstring(0 5, 5 0, 0-5, -5 0, 0 5), (0 5, 5 0, 0-5, -5 0, 0 5))',0); SET @h = geometry::stgeomfromtext('compoundcurve(circularstring(10 0, 0 10, -10 0), (-10 0, 0 0))', 0); SET @i = geometry::stgeomfromtext('curvepolygon(compoundcurve(circularstring(5 5, 0 10, -5 5), (-5 5, 5 5)))', 0); SELECT @e SELECT @i

DECLARE @e geometry; Błąd definicji krzywej SET @e = geometry::stgeomfromtext('circularstring(0 0, 0 5, 5 5, 0 0)', 0); SET @f = geometry::stgeomfromtext( 'CURVEPOLYGON(CIRCULARSTRING(10 10, 10 5, 5 5, 10 10))', 0); SELECT @e Łuki muszą mieć nieparzystą liczbę wierzchołków n 3 (w praktyce n 5) Msg 6522, Level 16, State 1, Line 4 A.NET Framework error occurred during execution of user-defined routine or aggregate "geometry": System.FormatException: 24142: Oczekiwano wartości, na pozycji 33. Dane wejściowe zawierają wartość ). System.FormatException: w Microsoft.SqlServer.Types.WellKnownTextReader.RecognizeToken(Char token) w Microsoft.SqlServer.Types.WellKnownTextReader.ParseCircularStringText() w Microsoft.SqlServer.Types.WellKnownTextReader.ParseTaggedText(OpenGisType type) w Microsoft.SqlServer.Types.WellKnownTextReader.Read(OpenGisType type, Int32 srid) w Microsoft.SqlServer.Types.SqlGeometry.GeometryFromText(OpenGisType type, SqlChars text, Int32 srid).

DECLARE @e geometry; DECLARE @a geometry; DECLARE @b geometry; DECLARE @c geometry; DECLARE @d geometry; Przykłady tworzenia - specjalizowane SET @a = geometry::stpointfromtext('point(5 7)', 0); SET @b = geometry::stmpointfromtext('multipoint(4 7, 11 5, 9 12, 8 8)', 0); SET @c = geometry::stlinefromtext('linestring(5 6, 7 8, 11 3)', 0); SET @d = geometry::stmlinefromtext('multilinestring((11 5, 7 4, 3 9), (5 3, 2 7, 6 5))', 0); SET @e = geometry::stpolyfromtext('polygon((8 3, 8 8, 12 3, 8 3))', 0); SET @f = geometry::stmpolyfromtext('multipolygon(((0 0, 5 5, 10 0, 0 0)), ((3 2, 5 1, 7 2, 3 2)))', 0); SELECT @a SELECT @b SELECT @c SELECT @d SELECT @e Nazwa funkcji musi być zgodna z rodzajem tworzonego elementu

Przykłady tworzenia SET @g = geometry::stgeomfromtext('geometrycollection(point (5 7), MULTIPOINT(4 7, 11 5, 9 12, 8 8), LINESTRING(5 6, 7 8, 11 3), MULTILINESTRING((11 5, 7 4, 3 9), (5 3, 2 7, 6 5)), POLYGON((8 3, 8 8, 12 3, 8 3)), MULTIPOLYGON(((0 0, 5 5, 10 0, 0 0)), ((3 2, 5 1, 7 2, 3 2))))', 0); GO SET @g = geometry::stgeomcollfromtext('geometrycollection(point (5 7), MULTIPOINT(4 7, 11 5, 9 12, 8 8), LINESTRING(5 6, 7 8, 11 3), MULTILINESTRING((11 5, 7 4, 3 9), (5 3, 2 7, 6 5)), POLYGON((8 3, 8 8, 12 3, 8 3)), MULTIPOLYGON(((0 0, 5 5, 10 0, 0 0)), ((3 2, 5 1, 7 2, 3 2))))', 0);

Przykłady tworzenia Każdy punkt może mieć trzy współrzędne X, Y, Z, czwarta wartość w definicji oznacza wagę SET @g = geometry::stgeomfromtext('polygon((0 0 0 1, 2 0 0 2, 2 2 0 3, 0 2 0 4, 0 0 0 5))', 0); SET @h = geometry::stgeomfromtext('point(1 1 0 6 )', 0); SET @f = geometry::stgeomfromtext('point(3 3 0 7 )', 0); W oknie Spatial results zawsze wyświetlane są tylko współrzędne X i Y bez względu na wartość współrzędnej Z

Spatial Data Polygon z dziurą w środku SET @f = geometry::stpolyfromtext( 'POLYGON((0 0, 0 3, 3 3, 3 0, 0 0), (1 1, 1 2, 2 1, 1 1))', 0); SET @g = geometry::stgeomfromtext( 'POLYGON((0 0, 0 3, 3 3, 3 0, 0 0), (1 1, 1 2, 2 1, 1 1))', 0); SET @h = geometry::stgeomfromtext( 'MULTIPOLYGON(((0 0, 0 3, 3 3, 3 0, 0 0), (1 1, 1 2, 2 1, 1 1)))', 0);

Przykłady tworzenia dla danych binarnych - Open Geospatial Consortium (OGC) Well-Known Binary (WKB) SET @g = geometry::stgeomfromwkb (0x010200000003000000000000000000594000000000000059400000000000003440000000000 080664000000000008066400000000000806640, 0);.STAsText(), @g.tostring(); LINESTRING (100 100, 20 180, 180 180) LINESTRING (100 100, 20 180, 180 180)

Przykłady tworzenia dla danych binarnych - Open Geospatial Consortium (OGC) Well-Known Binary (WKB) SET @g = geometry::stpointfromwkb (0x010100000000000000000059400000000000005940, 0);.STAsText(), @g.tostring(); POINT (100 100) POINT (100 100)

Metody dla obiektów geometria STArea STAsBinary STAsText STBoundary STBuffer STCentroid STContains STConvexHull STCrosses STDifference STDimension STDisjoint STDistance STEndpoint STEnvelope STEquals STExteriorRing STGeometryN STGeometryType STInteriorRingN STIntersection STIntersects STIsClosed STIsEmpty STIsRing STIsSimple STIsValid STLength STNumGeometries STNumInteriorRing STNumPoints STOverlaps STPointN STPointOnSurface STRelate STSrid STStartPoint STSymDifference STTouches STUnion STWithin STX STY

Spatial Data Metoda STAsBinary () Konwertuje typ geometry do wewnętrznego zapisu binarnego SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('point(3 3)', 0);.STAsBinary(), @g.stasbinary(), @h.stasbinary(); 0x010100000000000000000008400000000000000840 0x0103000000010000000500000000000000000000000000000000000000000000000000004000000000000000000 00000000000004000000000000000400000000000000000000000000000004000000000000000000000000000000000 0x0101000000000000000000F03F000000000000F03F

Spatial Data Metoda STAsBinary () Konwertuje typ geometry do wewnętrznego zapisu binarnego SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @f = geometry::stgeomfromtext('polygon((3 3, 1 1, 2 3, 3 3))', 0);.STAsBinary(), @g.stasbinary(), @h.stasbinary(); 0x0103000000010000000400000000000000000008400000000000000840000000000000F03F000000000000F03F00000000 00000840000000000000004000000000000008400000000000000840 0x01030000000100000005000000000000000000000000000000000000000000000000000040000000000000000000000 0000000004000000000000000400000000000000000000000000000004000000000000000000000000000000000 0x0103000000010000000400000000000000000000000000000000000000000000000000F03F000000000000F03F00000 00000000000000000000000004000000000000000000000000000000000

Spatial Data Metoda STAsText () Konwertuje typ geometry do typu znakowego, jest równoważna metodzie ToString() SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('point(3 3)', 0);.STAsText(), @g.stastext(), @h.stastext(); POINT (3 3) POLYGON ((0 0, 2 0, 2 2, 0 2, 0 0)) POINT (1 1)

Spatial Data Metoda STAsText () Konwertuje typ geometry do typu znakowego SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @f = geometry::stgeomfromtext('polygon((3 3, 1 1, 2 3, 3 3))', 0);.STAsText (), @g.stastext (), @h.stastext (); POLYGON ((3 3, 1 1, 2 3, 3 3)) POLYGON ((0 0, 2 0, 2 2, 0 2, 0 0)) POLYGON ((0 0, 1 1, 0 2, 0 0))

Spatial Data Metoda STArea () Zwraca pole powierzchni obiektu SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @f = geometry::stgeomfromtext('polygon((3 3, 1 1, 2 3, 3 3))', 0);.STArea(), @g.starea(), @h.starea(); 1 4 1

Spatial Data Metoda STBoundary() Wyznacza granice obiektu SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('linestring(3 3, 5 3, 4 5)', 0);.STBoundary().ToString(), @g.stboundary().tostring(), @h.stboundary().tostring();.stboundary().stboundary().stboundary(); MULTIPOINT ((4 5), (3 3)) LINESTRING (0 0, 2 0, 2 2, 0 2, 0 0) GEOMETRYCOLLECTION EMPTY

Spatial Data Metoda STBoundary() SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @f = geometry::stgeomfromtext('polygon((3 3, 1 1, 2 3, 3 3))', 0);.STBoundary().ToString(), @g.stboundary().tostring(), @h.stboundary().tostring();.stboundary().stboundary().stboundary(); Wyznacza granice obiektu LINESTRING (1 1, 3 3, 2 3, 1 1) LINESTRING (0 0, 2 0, 2 2, 0 2, 0 0) LINESTRING (0 0, 1 1, 0 2, 0 0)

Spatial Data Metoda STBuffer(x) Wyznacza granice obiektu we wskazanej odległości SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('linestring(3 3, 5 3, 4 5)', 0);.STBuffer(0.5).ToString(), @g.stbuffer(.5).tostring(), @h.stbuffer(.5).tostring();.stbuffer(0.5).stbuffer(0.5).stbuffer(0.5); POLYGON ((3 2.5, 5 2.5, 5.0162078738212585 2.5002619028091431, 5.0323328375816345 2.5010436773300171, 5.0483643412590027 2.5023394227027893, 5.0642918944358826 2.5041433572769165, 5.0801049470901489 2.5064495205879211, 5.0957929491996765 2.5092520713806152, 5.11134546995163 2.5125451683998108, 5.1267518997192383 2.51632297039032, 5.142001748085022 2.5205795764923096, 5.1570845246315 2.5253090858459473, 5.1719896197319031 2.5305056571960449, 5.18670654296875 2.5361633896827698, 5.2012248039245605 2.5422765016555786, 5.2155338525772095 2.5488390922546387, 5.2296231985092163 2.5558452606201172, 5.2434822916984558 2.5632891654968262, 5.2571005821228027 2.5711649060249329, 5.2704675197601318 2.5794666409492493, 5.2835727334022522 2.5881884694099426, 5.296405553817749 2.5973246097564697, 5.3089554905891418 2.6068691611289978, 5.32121205329895 2.6168161630630493, 5.3331646323204041 2.6271598339080811, 5.3448028564453125 2.637894332408905, 5.3561160564422607 2.6490137577056885, 5.3670937418937683 2.6605122089385986, 5.3880006074905396 2.6846228241920471, 5.3979087471961975 2.69722318649292, 5.4074392318725586 2.7101792097091675, 5.4165816307067871 2.7234848737716675, 5.4253253936767578 2.7371344566345215, 5.4336236119270325 2.751059353351593, 5.4414359927177429 2.7651870846748352, 5.4487619996070862 2.7795055508613586, 5.4556010961532593 2.7940026521682739, 5.4619527459144592 2.808666467666626, 5.4678164720535278 2.8234848976135254, 5.4731916189193726 2.8384459614753723, 5.47807765007019 2.8535375595092773, 5.482474148273468 2.8687476515769958,

Spatial Data Metoda STBuffer(x) SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @f = geometry::stgeomfromtext('polygon((3 3, 1 1, 2 3, 3 3))', 0);.STBuffer(0.5).ToString(), @g.stbuffer(.5).tostring(), @h.stbuffer(.5).tostring();.stbuffer(0.5).stbuffer(0.5).stbuffer(0.5); Wyznacza granice obiektu we wskazanej odległości POLYGON ((0.99696809053421021 0.50000190734863281, 1.0185931921005249 0.50034397840499878, 1.0401754379272461 0.50161665678024292, 1.061682939529419 0.50381749868392944, 1.0830835700035095 0.50694382190704346, 1.1043453812599182 0.51099306344985962, 1.1254363656044006 0.51596271991729736, 1.1463245153427124 0.5218501091003418, 1.1669778227806091 0.52865266799926758, 1.1873643398284912 0.53636789321899414, 1.2074519395828247 0.54499310255050659, 1.22720867395401 0.55452579259872437, 1.2466025352478027 0.56496334075927734, 1.2656015753746033 0.57630318403244019, 1.2841737270355225 0.58854275941848755, 1.3022869825363159 0.60167950391769409, 1.3199093341827393 0.61571073532104492, 1.3370088338851929 0.63063395023345947, 1.3535534143447876 0.6464465856552124, 3.3535534143447876 2.6464465856552124, 3.3666653633117676 2.6600608229637146, 3.3791863918304443 2.67407888174057, 3.3911129236221313 2.6884824633598328, 3.4024412035942078 2.7032531499862671, 3.4131676554679871 2.718372642993927, 3.4232886433601379 2.7338225245475769, 3.4328004717826843 2.7495844960212708, 3.4416995048522949 2.7656401395797729, 3.4499821066856384 2.7819711565971375, 3.4576445817947388 2.7985590696334839, 3.4646832942962646 2.815385639667511, 3.4710946083068848 2.8324324488639832, 3.476874828338623 2.8496811389923096, 3.4820203185081482 2.8671132922172546, 3.4865275025367737 2.8847106695175171, 3.4903926253318787 2.9024547934532166, 3.4936121106147766 2.920327365398407, 3.4961822628974915 2.9383100271224976, 3.4980993866920471 2.9563844203948975, 3.4993599653244019 2.9745321273803711,

Spatial Data Metoda STCentroid() Wyznacza środek obiektu SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('linestring(3 3, 5 3, 4 5)', 0);.STCentroid().ToString(), @g.stcentroid().tostring(), @h.stcentroid().tostring();.stcentroid().stcentroid().stcentroid(); NULL POINT (1 1) NULL

Spatial Data Metoda STCentroid() SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @f = geometry::stgeomfromtext('polygon((3 3, 1 1, 2 3, 3 3))', 0);.STCentroid().ToString(), @g.stcentroid().tostring(), @h.stcentroid().tostring();.stcentroid().stcentroid().stcentroid(); Wyznacza środek obiektu POINT (2 2.3333333333333335) POINT (1 1) POINT (0.33333333333333337 1)

Spatial Data Metoda STContains() Zwraca wartość 1 jeżeli instancja geometrii całkowicie zawiera się w drugiej instancji. SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('point(3 3)', 0);.STContains(@h), @g.stcontains(@f), @h.stcontains(@f); 1 0 0

Spatial Data Metoda STContains() Zwraca wartość 1 jeżeli instancja geometrii całkowicie zawiera się w drugiej instancji. SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @f = geometry::stgeomfromtext('polygon((3 3, 4 4, 3 2, 3 3))', 0);.STContains(@h), @g.stcontains(@f), @h.stcontains(@f); 1 0 0

Spatial Data Metoda STConvexHull() Wyznacza najmniejszy wielokąt zawierający obiekt SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('linestring(3 3, 5 3, 4 5)', 0);.STConvexHull().ToString(), @g.stconvexhull().tostring(), @h.stconvexhull().tostring();.stconvexhull().stconvexhull().stconvexhull(); POLYGON ((5 3, 4 5, 3 3, 5 3)) POLYGON ((2 0, 2 2, 0 2, 0 0, 2 0)) POINT (1 1)

Spatial Data Metoda STConvexHull() SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @f = geometry::stgeomfromtext('polygon((3 3, 1 1, 2 3, 3 3))', 0);.STConvexHull().ToString(), @g.stconvexhull().tostring(), @h.stconvexhull().tostring();.stconvexhull().stconvexhull().stconvexhull(); Wyznacza najmniejszy wielokąt zawierający obiekt POLYGON ((3 3, 2 3, 1 1, 3 3)) POLYGON ((2 0, 2 2, 0 2, 0 0, 2 0)) POLYGON ((1 1, 0 2, 0 0, 1 1))

Spatial Data Metoda STCrosses() Zwraca 1 jeżeli obiekt przecina inny obiekt (nie jest symetryczna @a.stcrosses(@b)<> @b.stcrosses(@a) ). W przeciwnym wypadku zwraca 0. DECLARE @e 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); SET @f = geometry::stgeomfromtext('linestring(3 3, 5 3, 4 5)', 0); SET @e = geometry::stgeomfromtext('linestring(4 2, 3 4)', 0);.STCrosses(@h), @g.stcrosses(@f), @h.stcrosses(@f), @e.stcrosses(@f); SELECT @e 0 0 0 1

Spatial Data Metoda STCrosses() Zwraca 1 jeżeli obiekt przecina inny obiekt (nie jest symetryczna @a.stcrosses(@b)<> @b.stcrosses(@a) ). W przeciwnym wypadku zwraca 0. DECLARE @e geometry; SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @f = geometry::stgeomfromtext('polygon((3 3, 2 3, 1 1, 3 3))', 0); SET @e = geometry::stgeomfromtext('linestring(3 2, 1 3, 0 1)', 0);.STCrosses(@h), @g.stcrosses(@f),@g.stcrosses(@e), @h.stcrosses(@f), @e.stcrosses(@f), @f.stcrosses(@e), @e.stcrosses(@g), @e.stcrosses(@h); SELECT @e 0 0 0 0 1 0 1 1

Spatial Data Metoda STDifference() Wyznacza różnicę dwóch obiektów SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('linestring(3 3, 5 3, 4 5)', 0);.STDifference(@g).ToString(), @f.stdifference(@h).tostring(), @g.stdifference(@h).tostring(), @g.stdifference(@f).tostring();.stdifference(@g).stdifference(@h).stdifference(@h).stdifference(@f); LINESTRING (4 5, 5 3, 3 3) LINESTRING (4 5, 5 3, 3 3) POLYGON ((0 0, 2 0, 2 2, 0 2, 0 0)) POLYGON ((0 0, 2 0, 2 2, 0 2, 0 0))

Spatial Data Metoda STDifference() SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @f = geometry::stgeomfromtext('polygon((3 3, 2 3, 1 1, 3 3))', 0);.STDifference(@g).ToString(), @f.stdifference(@h).tostring(), @g.stdifference(@h).tostring(), @g.stdifference(@f).tostring();.stdifference(@g).stdifference(@h).stdifference(@h).stdifference(@f); Wyznacza różnicę dwóch obiektów POLYGON ((1.5 2, 2 2, 3 3, 2 3, 1.5 2)) POLYGON ((1 1, 3 3, 2 3, 1 1)) POLYGON ((0 0, 2 0, 2 2, 0 2, 1 1, 0 0)) POLYGON ((0 0, 2 0, 2 2, 1 1, 1.5 2, 0 2, 0 0))

Spatial Data Metoda STDimension() Wyznacza wymiar obiektu SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('linestring(3 3, 5 3, 4 5)', 0);.STDimension(), @f.stdimension(), @g.stdimension(); 1 1 2

Spatial Data Metoda STDimension() SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @f = geometry::stgeomfromtext('polygon((3 3, 2 3, 1 1, 3 3))', 0);.STDimension(), @f.stdimension(), @g.stdimension(); 2 2 2 Wyznacza wymiar obiektu

Spatial Data Metoda STDisjoint() Zwraca 1 jeśli wskazane obiekty są rozłączne. W przeciwnym wypadku zwraca 0. SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('linestring(3 3, 5 3, 4 5)', 0);.STDisjoint(@g), @f.stdisjoint(@h), @g.stdisjoint(@h); 1 1 0

Spatial Data Metoda STDisjoint () Zwraca 1 jeśli wskazane obiekty są rozłączne. W przeciwnym wypadku DECLARE zwraca 0. @g 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); SET @f = geometry::stgeomfromtext('linestring(3 3, 5 3, 4 5)', 0);.STDisjoint(@g), @f.stdisjoint(@h), @g.stdisjoint(@h); 1 1 0

Spatial Data Metoda STDistance() Zwraca najmniejszą odległość miedzy punktem w geometrii a punktem w drugiej geometrii. SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('point(3 3)', 0);.STDistance(@h), @g.stdistance(@f), @h.stdistance(@f); 0 1,4142135623731 2,82842712474619

Spatial Data Metoda STDistance() Zwraca najmniejszą odległość miedzy punktem w geometrii a punktem w drugiej geometrii. SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @f = geometry::stgeomfromtext('polygon((3 3, 2 3, 1 1, 3 3))', 0);.STDistance(@h), @g.stdistance(@f), @h.stdistance(@f); 0 0 0

Zwraca ostatni punkt obiektu Spatial Data Metoda STEndPoint() SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('linestring(3 3, 5 3, 4 5)', 0);.STEndPoint().ToString(), @g.stendpoint().tostring(), @h.stendpoint().tostring(); POINT (4 5) POINT (0 0) POINT (1 1)

Zwraca ostatni punkt obiektu Spatial Data Metoda STEndPoint () SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @f = geometry::stgeomfromtext('polygon((3 3, 2 3, 1 1, 3 3))', 0);.STEndPoint().ToString(), @g.stendpoint().tostring(), @h.stendpoint().tostring(); POINT (3 3) POINT (0 0) POINT (0 0)

Spatial Data Metoda STEnvelope () Zwraca najmniejszy prostokąt zorientowany zgodnie z osiami i zawierający obiekt SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('linestring(3 3, 5 3, 4 5)', 0);.STEnvelope().ToString(), @g.stenvelope().tostring(), @h.stenvelope().tostring();.stenvelope().stenvelope().stenvelope() POLYGON ((3 3, 5 3, 5 5, 3 5, 3 3)) POLYGON ((0 0, 2 0, 2 2, 0 2, 0 0)) POLYGON ((0.999999 0.999999, 1.000001 0.999999, 1.000001 1.000001, 0.999999 1.000001, 0.999999 0.999999))

Spatial Data Metoda STEnvelope () Zwraca najmniejszy prostokąt zorientowany zgodnie z osiami i zawierający obiekt SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @f = geometry::stgeomfromtext('polygon((3 3, 2 3, 1 1, 3 3))', 0);.STEnvelope().ToString(), @g.stenvelope().tostring(), @h.stenvelope().tostring();.stenvelope().stenvelope().stenvelope() POLYGON ((1 1, 3 1, 3 3, 1 3, 1 1)) POLYGON ((0 0, 2 0, 2 2, 0 2, 0 0)) POLYGON ((0 0, 1 0, 1 2, 0 2, 0 0))

Spatial Data Metoda STEquals() Zwraca 1 jeśli geometria wskazuje ten sam zbiór punktów co inna geometria. W przeciwnym wypadku zwraca 0. SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('point(3 3)', 0);.STEquals(@h), @g.stequals(@f), @h.stequals(@f); 0 0 0

Spatial Data Metoda STEquals() Zwraca 1 jeśli geometria wskazuje ten sam zbiór punktow co inna geometria. W przeciwnym wypadku zwraca 0. 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);.STEquals(@h); 1

Spatial Data Metoda STExteriorRing() Zwraca wielokąt tworzący obwód obiektu SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('linestring(3 3, 5 3, 4 5)', 0);.STExteriorRing().ToString(), @g.stexteriorring().tostring(), @h.stexteriorring().tostring();.stexteriorring().stexteriorring().stexteriorring() NULL LINESTRING (0 0, 2 0, 2 2, 0 2, 0 0) NULL

Spatial Data Metoda STExteriorRing() Zwraca wielokąt tworzący obwód obiektu SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @f = geometry::stgeomfromtext('polygon((3 3, 2 3, 1 1, 3 3))', 0);.STExteriorRing().ToString(), @g.stexteriorring().tostring(), @h.stexteriorring().tostring();.stexteriorring().stexteriorring().stexteriorring() LINESTRING (3 3, 2 3, 1 1, 3 3) LINESTRING (0 0, 2 0, 2 2, 0 2, 0 0) LINESTRING (0 0, 1 1, 0 2, 0 0)

Spatial Data Metoda STGeometryN(n) Zwraca n-ty obiekt kolekcji SET @g = geometry::stgeomfromtext('multipolygon(((0 0, 1 0, 1 1, 0 0)), ((0 2, 2 2, 2 1, 0 2)))', 0); SET @h = geometry::stgeomfromtext('multipoint(1 2, 3 1 )', 0); SET @f = geometry::stgeomfromtext('multilinestring((3 3, 5 3, 4 5),(0 3, 2 3, 1 5))', 0);.STGeometryN(2).ToString(), @g.stgeometryn(2).tostring(), @h.stgeometryn(2).tostring();.stgeometryn(2).stgeometryn(2).stgeometryn(2) LINESTRING (0 3, 2 3, 1 5) POLYGON ((0 2, 2 2, 2 1, 0 2)) POINT (3 1)

Spatial Data Metoda STGeometryN(n) SET @g = geometry::stgeomfromtext('geometrycollection(point (5 7), MULTIPOINT(4 7, 11 5, 9 12, 8 8), LINESTRING(5 6, 7 8, 11 3), MULTILINESTRING((11 5, 7 4, 3 9), (5 3, 2 7, 6 5)), POLYGON((8 3, 8 8, 12 3, 8 3)), MULTIPOLYGON(((0 0, 5 5, 10 0, 0 0)), ((3 2, 5 1, 7 2, 3 2))))', 0);.STGeometryN(4).ToString().STGeometryN(4) Zwraca n-ty obiekt kolekcji Msg 6522, Level 16, State 1, Line 9 A.NET Framework error occurred during execution of user-defined routine or aggregate "geometry": System.ArgumentException: 24144: This operation cannot be completed because the instance is not valid. Use MakeValid to convert the instance to a valid instance. Note that MakeValid may cause the points of a geometry instance to shift slightly. System.ArgumentException: w Microsoft.SqlServer.Types.SqlGeometry.ThrowIfInvalid() w Microsoft.SqlServer.Types.SqlGeometry.STNumGeometries() w Microsoft.SqlServer.Types.SqlGeometry.STGeometryN(Int32 n). Msg 6522, Level 16, State 1, Line 10 A.NET Framework error occurred during execution of user-defined routine or aggregate "geometry": System.ArgumentException: 24144: This operation cannot be completed because the instance is not valid. Use MakeValid to convert the instance to a valid instance. Note that MakeValid may cause the points of a geometry instance to shift slightly. System.ArgumentException: w Microsoft.SqlServer.Types.SqlGeometry.ThrowIfInvalid() w Microsoft.SqlServer.Types.SqlGeometry.STNumGeometries() w Microsoft.SqlServer.Types.SqlGeometry.STGeometryN(Int32 n)

Spatial Data Metoda STGeometryN(n) SET @g = geometry::stgeomfromtext('geometrycollection(point (5 7), MULTIPOINT(4 7, 11 5, 9 12, 8 8), LINESTRING(5 6, 7 8, 11 3), MULTILINESTRING((11 5, 7 4, 3 9), (5 3, 2 7, 6 5)), POLYGON((8 3, 8 8, 12 3, 8 3)), MULTIPOLYGON(((0 0, 5 5, 10 0, 0 0)), ((3 2, 5 1, 7 2, 3 2))))', 0); SET @g=@g.makevalid();.stgeometryn(4).tostring().stgeometryn(4) Zwraca n-ty obiekt kolekcji LINESTRING (3 9, 5.2222222222222223 6.2222222222222223, 7 8, 8 6.75)

Spatial Data Metoda STGeometryType() Zwraca typ obiektu SET @g = geometry::stgeomfromtext('multipolygon(((0 0, 1 0, 1 1, 0 0)), ((0 2, 2 2, 2 1, 0 2)))', 0); SET @h = geometry::stgeomfromtext('multipoint(1 2, 3 1 )', 0); SET @f = geometry::stgeomfromtext('multilinestring((3 3, 5 3, 4 5),(0 3, 2 3, 1 5))', 0);.STGeometryType(), @g.stgeometrytype(), @h.stgeometrytype(); MultiLineString MultiPolygon MultiPoint

Spatial Data Metoda STGeometryType() Zwraca typ obiektu SET @g = geometry::stgeomfromtext('geometrycollection(point (5 7), MULTIPOINT(4 7, 11 5, 9 12, 8 8), LINESTRING(5 6, 7 8, 11 3), MULTILINESTRING((11 5, 7 4, 3 9), (5 3, 2 7, 6 5)), POLYGON((8 3, 8 8, 12 3, 8 3)), MULTIPOLYGON(((0 0, 5 5, 10 0, 0 0)), ((3 2, 5 1, 7 2, 3 2))))', 0); SET @g=@g.makevalid().stgeometrytype() GeometryCollection

Zwraca obwód wewnętrznego obiektu o danym SET @g = geometry::stgeomfromtext('polygon((0 indeksie 0, 5 5, 10 0, 0 0), (3 2, 5 1, 7 2, 3 2))', 0); SET @h = geometry::stgeomfromtext('multilinestring((3 3, 5 3, 4 5),(0 3, 2 3, 1 5))', 0); SET @f = geometry::stgeomfromtext('polygon((3 3, 2 3, 1 1, 3 3))', 0); Spatial Data Metoda STInteriorRingN(n).STInteriorRingN(1).ToString(), @g.stinteriorringn(1).tostring(), @h.stinteriorringn(1).tostring();.stinteriorringn(1).stinteriorringn(1).stinteriorringn(1) NULL LINESTRING (3 2, 5 1, 7 2, 3 2) NULL

Spatial Data Metoda STIntersection() Wyznacza część wspólną obiektów SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('linestring(3 3, 5 3, 4 5)', 0);.STIntersection(@g).ToString(), @g.stintersection(@h).tostring(), @h.stintersection(@f).tostring();.stintersection(@g).stintersection(@f).stintersection(@f) GEOMETRYCOLLECTION EMPTY POINT (1 1) GEOMETRYCOLLECTION EMPTY

Spatial Data Metoda STIntersection() Wyznacza część wspólną obiektów SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @f = geometry::stgeomfromtext('polygon((3 3, 2 3, 1 1, 3 3))', 0);.STIntersection(@g).ToString(), @g.stintersection(@h).tostring(), @h.stintersection(@f).tostring();.stintersection(@g).stintersection(@h).stintersection(@f) POLYGON ((1 1, 2 2, 1.5 2, 1 1)) POLYGON ((0 0, 1 1, 0 2, 0 0)) POINT (1 1)

Spatial Data Metoda STIntersects() Zwraca 1 jeżeli figura ma część wspólną z inną figurzą. W przeciwnym wypadku zwraca 0. SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('point(3 3)', 0);.STIntersects(@h), @g.stintersects(@f), @h.stintersects(@f); 1 0 0

Spatial Data Metoda STIntersects() Zwraca 1 jeżeli figura ma część wspólną z inną figurzą. W przeciwnym wypadku zwraca 0. SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @f = geometry::stgeomfromtext('polygon((3 3, 2 3, 1 1, 3 3))', 0);.STIntersects(@h), @g.stintersects(@f), @h.stintersects(@f); 1 1 1

Spatial Data Metoda STIsClosed() Zwraca 1 jeżeli figura jest zamknięta. W przeciwnym wypadku zwraca 0. SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('linestring(3 3, 5 3, 4 5)', 0);.STIsClosed(), @g.stisclosed(), @h.stisclosed(); 0 1 0

Spatial Data Metoda STIsClosed() Zwraca 1 jeżeli figura jest zamknięta. W przeciwnym wypadku zwraca 0. SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @f = geometry::stgeomfromtext('polygon((3 3, 2 3, 1 1, 3 3))', 0);.STIsClosed(), @g.stisclosed(), @h.stisclosed(); 1 1 1

Spatial Data Metoda STIsEmpty() Zwraca 1 jeżeli obiekt jest pusty. W przeciwnym wypadku zwraca 0. DECLARE @e geometry; SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point EMPTY', 0); SET @f = geometry::stgeomfromtext('linestring(3 3, 5 3, 4 5)', 0); SELECT @e.stisempty(),@f.stisempty(), @g.stisempty(), @h.stisempty(); SELECT @e NULL 0 0 1

Spatial Data Metoda STIsEmpty() Zwraca 1 jeżeli obiekt jest pusty. W przeciwnym wypadku zwraca 0. SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @f = geometry::stgeomfromtext('polygon((3 3, 2 3, 1 1, 3 3))', 0);.STIsEmpty(), @g.stisempty(), @h.stisempty(); 0 0 0

DECLARE @e geometry; DECLARE @d geometry; Spatial Data Metoda STIsRing() Zwraca 1 jeżeli obiekt jest prostą łamaną zamkniętą. W przeciwnym wypadku zwraca 0. SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point (0 3)', 0); SET @f = geometry::stgeomfromtext('linestring(3 3, 5 3, 4 5)', 0); SET @e = geometry::stgeomfromtext('linestring(2 3, 2 0, 3 2, 2 3)', 0); SET @d = geometry::stgeomfromtext('multilinestring((2 4, 2 5), (5 2, 2 3))', 0); SELECT @d.stisring(),@e.stisring(),@f.stisring(), @g.stisring(), @h.stisring(); SELECT @d SELECT @e NULL 1 0 NULL NULL

DECLARE @e geometry; DECLARE @d geometry; Spatial Data Metoda STIsSimple() Zwraca 1 jeżeli obiekt jest prosty. W przeciwnym wypadku zwraca 0. SET @g = geometry::stgeomfromtext('polygon((0 0, 3 0, 3 3, 0 3, 0 0))', 0); SET @h = geometry::stgeomfromtext('point (0 3)', 0); SET @f = geometry::stgeomfromtext('linestring(3 3, 5 3, 4 5)', 0); SET @e = geometry::stgeomfromtext('linestring(2 3, 2 0, 3 2, 2 3)', 0); SET @d = geometry::stgeomfromtext('linestring(0 0, 2 2, 0 2, 2 0)', 0); SELECT @d.stissimple(),@e.stissimple(),@f.stissimple(), @g.stissimple(), @h.stissimple(); SELECT @d SELECT @e 0 1 1 1 1

DECLARE @e geometry; DECLARE @d geometry; Spatial Data Metoda STIsValid() Zwraca 1 jeżeli obiekt jest poprawny. W przeciwnym wypadku zwraca 0. SET @g = geometry::stgeomfromtext('polygon((0 0, 3 0, 3 3, 0 3, 0 0))', 0); SET @h = geometry::stgeomfromtext('point (0 3)', 0); SET @f = geometry::stgeomfromtext('linestring(3 3, 5 3, 4 5)', 0); SET @e = geometry::stgeomfromtext('linestring(2 3, 2 0, 3 2, 2 3)', 0); SET @d = geometry::stgeomfromtext('linestring(0 0, 2 2, 4 4, 3 3)', 0); SELECT @d.stisvalid(),@e.stisvalid(),@f.stisvalid(), @g.stisvalid(), @h.stisvalid(); SELECT @d SELECT @e 0 1 1 1 1

Spatial Data Metoda STLength () Zwraca długość (obwód) obiektu. SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('linestring(0 0, 2 2, 0 2, 2 0)', 0);.STLength (), @g.stlength (), @h.stlength (); 7.65685424949238 8 0

Spatial Data Metoda STLength () Zwraca długość (obwód) obiektu. SET @g = geometry::stgeomfromtext('multipolygon(((0 0, 3 0, 3 3, 0 3, 0 0)), ((1 1, 2 2, 1 2, 1 1)))', 0); SET @f = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('multilinestring((2 4, 2 5), (5 2, 2 3))', 0);.STLength(), @g.makevalid().stlength(), @h.stlength(); Zastosowanie obiektów typu MULTI może wymusić użycie metody MakeValid() 4.82842712474619 15.4142135623731 4.16227766016838

Spatial Data Metoda STNumGeometries () Zwraca liczbę obiektów kolekcji (MULTI..., GeometryCollection). SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('linestring(0 0, 2 2, 0 2, 2 0)', 0);.STNumGeometries(), @g.stnumgeometries(), @h.stnumgeometries(); 1 1 1

Spatial Data Metoda STNumGeometries () Zwraca liczbę obiektów kolekcji (MULTI..., GeometryCollection). SET @g = geometry::stgeomfromtext('multipolygon(((0 0, 3 0, 3 3, 0 3, 0 0)), ((1 1, 2 2, 1 2, 1 1)))', 0); SET @f = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('multilinestring((2 4, 2 5), (5 2, 2 3))', 0);.STNumGeometries(), @g.makevalid().stnumgeometries(), @h.stnumgeometries(); 1 1 2

Spatial Data Metoda STNumInteriorRing() Zwraca liczbę wewnętrznych obwodów wielokąta SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('linestring(0 0, 2 2, 0 2, 2 0)', 0);.STNumInteriorRing(), @g.stnuminteriorring(), @h.stnuminteriorring(); NULL 0 NULL

Spatial Data Metoda STNumInteriorRing() Zwraca liczbę wewnętrznych obwodów wielokąta DECLARE @e geometry; SET @g = geometry::stgeomfromtext('multipolygon(((0 0, 3 0, 3 3, 0 3, 0 0)), ((1 1, 2 2, 1 2, 1 1)))', 0); SET @f = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((4 5, 4 8, 8 8, 8 5, 4 5), (5 6, 5 7, 7 7, 7 6, 5 6))', 0); SET @e = geometry::stgeomfromtext('polygon((4 0, 4 5, 8 5, 8 0, 4 0), (5 3, 5 4, 7 4, 7 3, 5 3), (5 1, 5 2, 7 2, 7 1, 5 1))', 0); SELECT @e.stnuminteriorring(),@f.stnuminteriorring(), @g.stnuminteriorring(), @h.stnuminteriorring(); SELECT @e 2 0 NULL 1

Spatial Data Metoda STNumPoints () Zwraca liczbę punktów wchodzących w skład obiektu SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('linestring(0 0, 2 2, 0 2, 2 0)', 0);.STNumPoints(), @g.stnumpoints(), @h.stnumpoints(); 4 5 1

DECLARE @e geometry; Spatial Data Metoda STNumPoints () Zwraca liczbę punktów wchodzących w skład obiektu SET @g = geometry::stgeomfromtext('multipolygon(((0 0, 3 0, 3 3, 0 3, 0 0)), ((1 1, 2 2, 1 2, 1 1)))', 0); SET @f = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((4 5, 4 8, 8 8, 8 5, 4 5), (5 6, 5 7, 7 7, 7 6, 5 6))', 0); SET @e = geometry::stgeomfromtext('polygon((4 0, 4 5, 8 5, 8 0, 4 0), (5 3, 5 4, 7 4, 7 3, 5 3), (5 1, 5 2, 7 2, 7 1, 5 1))', 0); SELECT @e.stnumpoints(),@f.stnumpoints(), @g.makevalid().stnumpoints(), @h.stnumpoints(); SELECT @e 15 4 9 10

Spatial Data Metoda STOverlaps() Zwraca 1 jeżeli figura nachodzi na drugą figurę. W przeciwnym wypadku zwraca 0. SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('point(3 3)', 0);.STOverlaps(@h), @g.stoverlaps(@f), @h.stoverlaps(@f); 0 0 0

Spatial Data Metoda STOverlaps() Zwraca 1 jeżeli figura nachodzi na drugą figurę. W przeciwnym wypadku zwraca 0. SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @f = geometry::stgeomfromtext('polygon((3 3, 2 3, 1 1, 3 3))', 0);.STOverlaps(@h), @g.stoverlaps(@f), @h.stoverlaps(@f); 0 1 0

Spatial Data Metoda STPointOnSurface() Zwraca punkt na powierzchni obiektu SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('linestring(0 0, 2 2, 0 2, 2 0)', 0);.STPointOnSurface().ToString(), @g.stpointonsurface().tostring(), @h.stpointonsurface().tostring(); POINT (1 1) POINT (1.3333333333333333 1.3333333333333333) POINT (1 1)

Spatial Data Metoda STPointOnSurface() Zwraca punkt na powierzchni obiektu DECLARE @e geometry; SET @g = geometry::stgeomfromtext('multipolygon(((0 0, 3 0, 3 3, 0 3, 0 0)), ((1 1, 2 2, 1 2, 1 1)))', 0); SET @f = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((4 5, 4 8, 8 8, 8 5, 4 5), (5 6, 5 7, 7 7, 7 6, 5 6))', 0); SET @e = geometry::stgeomfromtext('polygon((4 0, 4 5, 8 5, 8 0, 4 0), (5 3, 5 4, 7 4, 7 3, 5 3), (5 1, 5 2, 7 2, 7 1, 5 1))', 0); SELECT @e.stpointonsurface().tostring(),@f.stpointonsurface().tostring(), @g.makevalid().stpointonsurface().tostring(), @h.stpointonsurface().tostring(); SELECT @e POINT (6.333333333333333 4.666666666666667) POINT (0.33333333333333331 1) POINT (1.6666666666666667 2.6666666666666665) POINT (6.333333333333333 7.666666666666667)

Macierz wzorca Macierz wzorca składa się z dziewięciu znaków określających wymiar obiektu powstałego na skutek wykonania operacji przecięcia każdego z elementu określającego figurę Wnętrze (Interior), Brzeg (Boundary), Zewnętrze (Exterior) gdzie: dim(x) {-1, 0, 1, 2} wartość 1 odpowiada dim( ). a\b Wnętrze (Interior) Brzeg (Boundary) Zewnętrze (Exterior) Wnętrze (Interior) Brzeg (Boundary) Zewnętrze (Exterior) dim(i(a) I(b)) dim(i(a) B(b)) dim(i(a) E(b)) dim(b(a) I(b)) dim(b(a) B(b)) dim(b(a) E(b)) dim(e(a) I(b)) dim(e(a) BI(b)) dim(e(a) E(b))

Macierz wzorca a\b Wnętrze (Interior) Brzeg (Boundary) Zewnętrze (Exterior) Wnętrze (Interior) Brzeg (Boundary) Zewnętrze (Exterior) 2 1 2 1 0 1 2 1 2

Macierz wzorca W przypadku definiowania filtrów możliwe jest zastosowanie rozszerzonego zestawu znaków p {T, F, *, 0, 1, 2}, które oznaczają: p = T dim(x) {0, 1, 2}, czyli x p = F dim(x) = -1, czyli x = p = * dim(x) {-1, 0, 1, 2}, (dowolna wartość) p = 0 dim(x) = 0 p = 1 dim(x) = 1 p = 2 dim(x) = 2 Przykłady: Są rozłączne a.disjoint(b) a b = Co można rozpisać: a.disjoint(b) [(I(a) I(b) = ) (I(a) B(b) = ) (B(a) I(b) = ) (B(a) B(b) = ) ] a.relate(b, FF*FF**** )

Macierz wzorca W przypadku definiowania filtrów możliwe jest zastosowanie rozszerzonego zestawu znaków p {T, F, *, 0, 1, 2}, które oznaczają: p = T dim(x) {0, 1, 2}, czyli x p = F dim(x) = -1, czyli x = p = * dim(x) {-1, 0, 1, 2}, (dowolna wartość) p = 0 dim(x) = 0 p = 1 dim(x) = 1 p = 2 dim(x) = 2 Przykłady: Są rozłączne a.disjoint(b) a b = Co można rozpisać: a.disjoint(b) [(I(a) I(b) = ) (I(a) B(b) = ) (B(a) I(b) = ) (B(a) B(b) = ) ] a.relate(b, FF*FF**** )

Macierz wzorca Dotykają się: a.touch(b) (I(a) I(b) = ) (a b) Co można rozpisać: [a.touch(b) [I(a) I(b) = ) [(B(a) I(b) ) (I(a) B(b) ) (B(a) B(b) ) ]] [a.relate(b, FT******* ) a.relate(b, F**T***** ) a.relate(b, F***T**** )]

Spatial Data Metoda STRelate() Zwraca 1 jeśli obiekty wchodzą w relacje określoną wzorcem. W przeciwnym przypadku zwraca 0. SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('linestring(0 0, 2 2, 0 2, 2 0)', 0);.STRelate(@g,'FF*FF****'), @f.strelate(@h,'ff*ff****'), @h.strelate(@g,'ff*ff****'); 0 0 0

DECLARE @e geometry; Spatial Data Metoda STRelate() SET @g = geometry::stgeomfromtext('multipolygon(((0 0, 3 0, 3 3, 0 3, 0 0)), ((1 1, 2 2, 1 2, 1 1)))', 0); SET @f = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((4 5, 4 8, 8 8, 8 5, 4 5), (5 6, 5 7, 7 7, 7 6, 5 6))', 0); SET @e = geometry::stgeomfromtext('polygon((4 0, 4 5, 8 5, 8 0, 4 0), (5 3, 5 4, 7 4, 7 3, 5 3), (5 1, 5 2, 7 2, 7 1, 5 1))', 0);.STRelate(@e,'FF*FF****'), @f.strelate(@h,'ff*ff****'), @h.strelate(@f,'ff*ff****'); SELECT @e Zwraca 1 jeśli obiekty wchodzą w relacje określoną wzorcem. W przeciwnym przypadku zwraca 0. 1 1 1

Spatial Data Metoda STSrid Zwraca identyfikator obiektu lub może zostać użyta do jego zmiany SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 11); SET @f = geometry::stgeomfromtext('linestring(0 0, 2 2, 0 2, 2 0)', 5); SET @h.stsrid=7.stsrid, @g.stsrid, @h.stsrid; 5 0 7

Spatial Data Metoda STStartPoint() Zwraca punkt początkowy obiektu SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('linestring(0 0, 2 2, 0 2, 2 0)', 0);.STStartPoint().ToString(), @g.ststartpoint().tostring(), @h.ststartpoint().tostring(); POINT (0 0) POINT (0 0) POINT (1 1)

Spatial Data Metoda STStartPoint() Zwraca punkt początkowy obiektu DECLARE @e geometry; SET @g = geometry::stgeomfromtext('multipolygon(((0 0, 3 0, 3 3, 0 3, 0 0)), ((1 1, 2 2, 1 2, 1 1)))', 0); SET @f = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((4 5, 4 8, 8 8, 8 5, 4 5), (5 6, 5 7, 7 7, 7 6, 5 6))', 0); SET @e = geometry::stgeomfromtext('polygon((4 0, 4 5, 8 5, 8 0, 4 0), (5 3, 5 4, 7 4, 7 3, 5 3), (5 1, 5 2, 7 2, 7 1, 5 1))', 0); SELECT @e.ststartpoint().tostring(),@f.ststartpoint().tostring(), @g.makevalid().ststartpoint().tostring(), @h.ststartpoint().tostring(); SELECT @e POINT (4 0) POINT (0 0) POINT (0 0) POINT (4 5)

Spatial Data Metoda STSymDifference() Wyznacza symetryczną różnicę obiektów SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('linestring(3 3, 5 3, 4 5)', 0);.STSymDifference(@g).ToString(), @g.stsymdifference(@h).tostring(), @h.stsymdifference(@f).tostring();.stsymdifference(@g).stsymdifference(@f).stsymdifference(@f) GEOMETRYCOLLECTION (LINESTRING (4 5, 5 3, 3 3), POLYGON ((0 0, 2 0, 2 2, 0 2, 0 0))) POLYGON ((0 0, 2 0, 2 2, 0 2, 0 0)) GEOMETRYCOLLECTION (LINESTRING (4 5, 5 3, 3 3), POINT (1 1))

Spatial Data Metoda STSymDifference() Wyznacza symetryczną różnicę obiektów SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @f = geometry::stgeomfromtext('polygon((3 3, 2 3, 1 1, 3 3))', 0);.STSymDifference(@g).ToString(), @g.stsymdifference(@h).tostring(), @h.stsymdifference(@f).tostring();.stsymdifference(@g).stsymdifference(@f).stsymdifference(@f) MULTIPOLYGON (((1.5 2, 2 2, 3 3, 2 3, 1.5 2)), ((0 0, 2 0, 2 2, 1 1, 1.5 2, 0 2, 0 0))) POLYGON ((0 0, 2 0, 2 2, 0 2, 1 1, 0 0)) MULTIPOLYGON (((1 1, 3 3, 2 3, 1 1)), ((0 0, 1 1, 0 2, 0 0)))

Spatial Data Metoda STTouches() Zwraca 1 jeżeli figura dotyka innej figury. W przeciwnym wypadku zwraca SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('point(3 3)', 0);.STTouches(@h), @g.sttouches(@f), @h.sttouches(@f); 0 0 0

Spatial Data Metoda STTouches() Zwraca 1 jeżeli figura dotyka innej figury. W przeciwnym wypadku zwraca DECLARE @e geometry; SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @f = geometry::stgeomfromtext('polygon((3 3, 2 3, 1 1, 3 3))', 0); SET @e = geometry::stgeomfromtext('polygon((2 2, 3 1, 2 0, 2 2))', 0);.STTouches(@h), @g.sttouches(@f), @h.sttouches(@f), @g.sttouches(@e); SELECT @e 0 0 1 1

Spatial Data Metoda STUnion() Wyznacza sumę obiektów SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('linestring(3 3, 5 3, 4 5)', 0);.STUnion(@g).ToString(), @g.stunion(@h).tostring(), @h.stunion(@f).tostring();.stunion(@g).stunion(@f).stunion(@f) GEOMETRYCOLLECTION (LINESTRING (4 5, 5 3, 3 3), POLYGON ((0 0, 2 0, 2 2, 0 2, 0 0))) POLYGON ((0 0, 2 0, 2 2, 0 2, 0 0)) GEOMETRYCOLLECTION (LINESTRING (4 5, 5 3, 3 3), POINT (1 1))

Spatial Data Metoda STUnion() Wyznacza sumę obiektów SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @f = geometry::stgeomfromtext('polygon((3 3, 2 3, 1 1, 3 3))', 0);.STUnion(@g).ToString(), @g.stunion(@h).tostring(), @h.stunion(@f).tostring();.stunion(@g).stunion(@f).stunion(@f) POLYGON ((0 0, 2 0, 2 2, 3 3, 2 3, 1.5 2, 0 2, 0 0)) POLYGON ((0 0, 2 0, 2 2, 0 2, 0 0)) MULTIPOLYGON (((1 1, 3 3, 2 3, 1 1)), ((0 0, 1 1, 0 2, 0 0)))

Spatial Data Metoda STWithin() Zwraca 1 jeżeli figura znajduję się całkowicie wewnątrz drugiej figury SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('point(3 3)', 0);.STWithin(@h), @g.stwithin(@f), @h.stwithin(@f); 0 0 0

Spatial Data Metoda STWithin() Zwraca 1 jeżeli figura znajduję się całkowicie wewnątrz drugiej figury DECLARE @e geometry; SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @f = geometry::stgeomfromtext('polygon((3 3, 2 3, 1 1, 3 3))', 0); SET @e = geometry::stgeomfromtext('polygon((2 2, 3 1, 2 0, 2 2))', 0);.STWithin(@h), @g.stwithin(@f), @h.stwithin(@f), @g.stwithin(@e); SELECT @e 0 0 0 0

Spatial Data Metody STX i STY Zwracają odpowiednią współrzędną punktu. Dla danych różnych niż punkt NULL SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('point(3 3)', 0);.STX, @h.sty, @f.stx, @f.sty, @g.stpointn(3).stx, @g.stpointn(3).sty, @g.stx; 1 1 3 3 2 2 NULL

Metody walidujące oraz rozszerzone metody statyczne dla obiektów geometria AsGml (geometry Data Type) AsTextZM (geometry Data Type) BufferWithTolerance (geometry Data Type) InstanceOf (geometry Data Type) Filter (geometry Data Type) IsNull (geometry Data Type) M (geometry Data Type) MakeValid (geometry Data Type) Reduce (geometry Data Type) ToString (geometry Data Type) Z (geometry Data Type) GeomFromGML Null Parse Point

Spatial Data Metoda AsGml() Zwraca opis obiektu w języku GML (Geography Markup Language) SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('point(3 3)', 0);.AsGml(), @g.asgml(), @h.asgml(); <Point xmlns="http://www.opengis.net/gml"><pos>3 3</pos></Point> <Polygon xmlns="http://www.opengis.net/gml"><exterior><linearring><poslist>0 0 2 0 2 2 0 2 0 0</posList></LinearRing></exterior></Polygon> <Point xmlns="http://www.opengis.net/gml"><pos>1 1</pos></Point>

Spatial Data Metoda AsGml() DECLARE @e geometry; SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @f = geometry::stgeomfromtext('polygon((3 3, 2 3, 1 1, 3 3))', 0); SET @e = geometry::stgeomfromtext('polygon((2 2, 3 1, 2 0, 2 2))', 0); SELECT @e.asgml(), @f.asgml(), @g.asgml(), @h.asgml(); SELECT @e Zwraca opis obiektu w języku GML (Geography Markup Language.) <Polygon xmlns="http://www.opengis.net/gml"><exterior><linearring><poslist>2 2 3 1 2 0 2 2</posList></LinearRing></exterior></Polygon> <Polygon xmlns="http://www.opengis.net/gml"><exterior><linearring><poslist>3 3 2 3 1 1 3 3</posList></LinearRing></exterior></Polygon> <Polygon xmlns="http://www.opengis.net/gml"><exterior><linearring><poslist>0 0 2 0 2 2 0 2 0 0</posList></LinearRing></exterior></Polygon> <Polygon xmlns="http://www.opengis.net/gml"><exterior><linearring><poslist>0 0 1 1 0 2 0 0</posList></LinearRing></exterior></Polygon>

<obrazek> <Point xmlns="http://www.opengis.net/gml"><pos>3 3</pos></Point> <Polygon xmlns="http://www.opengis.net/gml"><exterior><linearring><poslist>2 2 3 1 2 0 2 2</posList></LinearRing></exterior></Polygon> <Polygon xmlns="http://www.opengis.net/gml"><exterior><linearring><poslist>3 3 2 3 1 1 3 3</posList></LinearRing></exterior></Polygon> <Polygon xmlns="http://www.opengis.net/gml"><exterior><linearring><poslist>0 0 2 0 2 2 0 2 0 0</posList></LinearRing></exterior></Polygon> <Polygon xmlns="http://www.opengis.net/gml"><exterior><linearring><poslist>0 0 1 1 0 2 0 0</posList></LinearRing></exterior></Polygon> </obrazek> Plik GML (Geography Markup Language)

Spatial Data Metoda AsTextZM () Zwraca tak samo jak ToString opis obiektu z uwzględnieniem współrzędnej Z oraz miary M - odmiennie do STAsText, która podaje tylko współrzędne XY SET @g = geometry::stgeomfromtext('polygon((0 0 1 11, 2 0 2 10, 2 2 3 9, 0 2, 0 0 4 8))', 0); SET @h = geometry::stgeomfromtext('point(1 1 5 7)', 0); SET @f = geometry::stgeomfromtext('point(3 3 6 6)', 0);.AsTextZM(), @g.astextzm(), @h.astextzm().stastext(), @g.stastext(), @h.stastext(); POINT (3 3 6 6) POLYGON ((0 0 1 11, 2 0 2 10, 2 2 3 9, 0 2, 0 0 4 8)) POINT (1 1 5 7) POINT (3 3) POLYGON ((0 0, 2 0, 2 2, 0 2, 0 0)) POINT (1 1)

Zwraca obiekt otaczający geometrię w odległości x, z tolerancją z. Trzeci parametr DECLARE @e geometry; określa czy tolerancja jest względna 0 lub SET @g = geometry::stgeomfromtext('polygon((0 bezwzględna 1. 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @f = geometry::stgeomfromtext('polygon((3 3, 2 3, 1 1, 3 3))', 0); SET @e = geometry::stgeomfromtext('polygon((2 2, 3 1, 2 0, 2 2))', 0); SELECT @e.bufferwithtolerance(0.1, 0.05, 0).ToString(), @f.bufferwithtolerance(0.1, 0.05, 0).ToString(), @g.bufferwithtolerance(0.1, 0.05, 0).ToString(), @h.bufferwithtolerance(0.1, 0.05, 0).ToString(); SELECT @e.bufferwithtolerance(0.1, 0.05, 0).BufferWithTolerance(0.1, 0.05, 0).BufferWithTolerance(0.1, 0.05, 0).BufferWithTolerance(0.1, 0.05, 0); SELECT @e Spatial Data Metoda BufferWithTolerance(x, t, f) POLYGON ((1.9617316424846649-0.092387974262237549, 2.070710688829422-0.070710659027099609, 3.070710688829422 0.92928934097290039, 3.1000000238418579 1, 3.070710688829422 1.0707106590270996, 2.070710688829422 2.0707106590270996, 1.9617316424846649 2.0923879742622375, 1.9000000059604645 2, 1.9000000059604645 0, 1.9617316424846649-0.092387974262237549)) POLYGON ((1.0080351233482361 0.90032333135604858, 1.0707106590270996 0.92928934097290039, 3.0707106590270996 2.9292893409729004, 3.0923879742622375 3.0382683277130127, 3 3.1000000238418579, 2 3.1000000238418579, 1.9105572700500488 3.0447213649749756, 0.91055727005004883 1.0447213649749756, 0.90289747714996338 0.97610223293304443, 0.94152897596359253 0.91887575387954712, 1.0080351233482361 0.90032333135604858)) POLYGON ((0-0.10000002384185791, 2-0.10000002384185791, 2.0707107186317444-0.070710659027099609, 2.1000000238418579 0, 2.1000000238418579 2, 2.0707107186317444 2.0707107186317444, 2 2.1000000238418579, 0 2.1000000238418579, -0.070710659027099609 2.0707107186317444, -0.10000002384185791 2, -0.10000002384185791 0, -0.070710659027099609-0.070710659027099609, 0 -

POLYGON ((1.9617316424846649-0.092387974262237549, 2.070710688829422-0.070710659027099609, 3.070710688829422 0.92928934097290039, 3.070710688829422 1.0707106590270996, 2.070710688829422 2.0707106590270996, 1.9617316424846649 2.0923879742622375, 1.9000000059604645 2, 1.9000000059604645 0, 1.9617316424846649-0.092387974262237549)) POLYGON ((0.94152897596359253 0.91887575387954712, 1.0707106590270996 0.92928934097290039, 3.0707106590270996 2.9292893409729004, 3.0923879742622375 3.0382683277130127, 3 3.1000000238418579, 2 3.1000000238418579, 1.9105572700500488 3.0447213649749756, 0.91055727005004883 1.0447213649749756, 0.94152897596359253 0.91887575387954712)) POLYGON ((0-0.10000002384185791, 2-0.10000002384185791, 2.1000000238418579 0, 2.1000000238418579 2, 2 2.1000000238418579, 0 2.1000000238418579, -0.10000002384185791 2, - 0.10000002384185791 0, 0-0.10000002384185791)) POLYGON ((-0.038268357515335083-0.092387974262237549, 0.070710688829422-0.070710659027099609, 1.070710688829422 0.92928934097290039, 1.070710688829422 1.0707106590270996, 0.070710688829422 2.0707106590270996, -0.038268357515335083 2.0923879742622375, -0.099999994039535522 2, - Zwraca obiekt otaczający geometrię w odległości x, z tolerancją z. Trzeci parametr DECLARE @e geometry; określa czy tolerancja jest względna 0 lub SET @g = geometry::stgeomfromtext('polygon((0 bezwzględna 1. 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @f = geometry::stgeomfromtext('polygon((3 3, 2 3, 1 1, 3 3))', 0); SET @e = geometry::stgeomfromtext('polygon((2 2, 3 1, 2 0, 2 2))', 0); SELECT @e.bufferwithtolerance(0.1, 0.05, 1).ToString(), @f.bufferwithtolerance(0.1, 0.05,1).ToString(), @g.bufferwithtolerance(0.1, 0.05, 1).ToString(), @h.bufferwithtolerance(0.1, 0.05, 1).ToString(); SELECT @e.bufferwithtolerance(0.1, 0.05, 1).BufferWithTolerance(0.1, 0.05, 1).BufferWithTolerance(0.1, 0.05, 1).BufferWithTolerance(0.1, 0.05, 1); SELECT @e Spatial Data Metoda BufferWithTolerance(x, t, f)

Spatial Data Metoda InstanceOf(typ) Zwraca informacje czy obiekt jest wskazanego parametrem typu SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('point(3 3)', 0);.InstanceOf('POLYGON'), @f.instanceof('point'), @g.instanceof('polygon'), @h.instanceof('multipolygon'), @h.instanceof('geometrycollection'); 0 1 1 0 0

Spatial Data Metoda InstanceOf(typ) Zwraca informacje czy obiekt jest wskazanego parametrem typu SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @f = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('multipolygon(((3 3, 2 3, 1 1, 3 3)), ((2 2, 3 1, 2 0, 2 2)))', 0);.InstanceOf('POLYGON'), @f.instanceof('point'), @g.instanceof('polygon'), @h.instanceof('polygon'),@h.instanceof('multipolygon'), @h.instanceof('geometrycollection'); 1 0 1 0 1 1

Spatial Data Metoda Filter() Zwraca informacje czy dwa obiekty przecinają się (mają część wspólną SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('point(3 3)', 0);.Filter(@g), @f.filter(@h), @g.filter(@h), @h.filter(@g); 0 0 1 1

Spatial Data Metoda Filter() Zwraca informacje czy dwa obiekty przecinają się (mają część wspólną) DECLARE @e geometry; SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @f = geometry::stgeomfromtext('polygon((3 3, 2 3, 1 1, 3 3))', 0); SET @e = geometry::stgeomfromtext('polygon((2 2, 3 1, 2 0, 2 2))', 0); SELECT @e.filter(@f), @e.filter(@g), @e.filter(@h),@f.filter(@g), @f.filter(@h), @g.filter(@h), @h.filter(@g); SELECT @e 1 1 0 1 1 1 1

DECLARE @e geometry; Spatial Data Metoda IsNull Zwraca informacje czy obiekt jest pusty NULL SET @g = geometry::stgeomfromtext('polygon((0 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext(null, 0); SELECT @e.isnull, @f.isnull, @g.isnull, @h.isnull; SELECT @e NULL NULL 0 0

Spatial Data Metoda M Zwraca wartość wagi dla obiektu SET @g = geometry::stgeomfromtext('polygon((0 0 1 11, 2 0 2 10, 2 2 3 9, 0 2, 0 0 4 8))', 0); SET @h = geometry::stgeomfromtext('point(1 1 5 7)', 0); SET @f = geometry::stgeomfromtext('point(3 3 6 6)', 0);.M, @g.stpointn(2).m, @g.m, @h.m 6 10 NULL 7

Spatial Data MakeValid() Zmienia niewłaściwą instancje figury na instancję zgodną z OGC. DECLARE @g geometry SET @g= geometry::stgeomfromtext('linestring(1 1, 1 4, 5 4, 1 4)', 0);.ToString(), @g.makevalid().tostring() LINESTRING (1 1, 1 4, 5 4, 1 4) LINESTRING (5 4, 1 4, 1 1)

Spatial Data Metoda Reduce() Redukuje geometrię zgodnie z algorytmem Douglas-Peuckera ze wskazaną tolerancją SET @g = geometry::stgeomfromtext('polygon((0 0, 1 1.6, 2 0, 2 2, 1 2.5, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('point(1 1)', 0); SET @f = geometry::stgeomfromtext('point(3 3)', 0);.Reduce(0.5).ToString(), @g.reduce(0.5).tostring(), @h.reduce(0.5).tostring();.reduce(0.5).reduce(0.5).reduce(0.5); POINT (3 3) POLYGON ((0 0, 1 1.6, 2 0, 2 2, 0 2, 0 0)) POINT (1 1)

Spatial Data Metoda Reduce() Zwraca informacje czy dwa obiekty przecinają się (mają część wspólną) DECLARE @e geometry; SET @g = geometry::stgeomfromtext('polygon((0 0, 1 0, 2 0, 2 2, 0 2, 0 0))', 0); SET @h = geometry::stgeomfromtext('polygon((0 0, 1 1, 0 2, 0 0))', 0); SET @f = geometry::stgeomfromtext('linestring(3 3, 2 3, 1.4 2.3, 1 1)', 0); SET @e = geometry::stgeomfromtext('polygon((2 2, 3 1, 2 0, 2.4 1.1, 2 2))', 0); SELECT @e.reduce(0.5).tostring(), @f.reduce(0.5).tostring(), @g.reduce(0.5).tostring(), @h.reduce(0.5).tostring(); SELECT @e.reduce(0.5).reduce(0.5).reduce(0.5).reduce(0.5); SELECT @e POLYGON ((2 2, 3 1, 2 0, 2 2)) LINESTRING (3 3, 2 3, 1 1) POLYGON ((0 0, 2 0, 2 2, 0 2, 0 0)) POLYGON ((0 0, 1 1, 0 2, 0 0))

Spatial Data Metoda ToString Zwraca postać znakową obiektu SET @g = geometry::stgeomfromwkb (0x010200000003000000000000000000004000000000000000400000000000000080 000000000000064000000000000006400000000000000040, 0); SET @h = geometry::stpointfromwkb (0x010100000000000000000000400000000000000080, 0);.ToString(), @h.tostring(); LINESTRING (2 2, 0 2.75, 2.75 2) POINT (2 0)

Spatial Data Metoda Z Zwraca wartość współrzędnej Z dla obiektu SET @g = geometry::stgeomfromtext('polygon((0 0 1 11, 2 0 2 10, 2 2 3 9, 0 2, 0 0 4 8))', 0); SET @h = geometry::stgeomfromtext('point(1 1 5 7)', 0); SET @f = geometry::stgeomfromtext('point(3 3 6 6)', 0);.Z, @g.stpointn(2).z, @g.m, @h.z 6 2 NULL 5

Spatial Data Metoda GeomFromGml () DECLARE @x xml; SET @x = '<Polygon Zwraca z opisu obiektu w języku GML (Geography Markup Language) postać geometry obiektu xmlns="http://www.opengis.net/gml"><exterior><linearring><poslist>2 2 3 1 2 0 2 2</posList></LinearRing></exterior></Polygon>'; SET @f = geometry::geomfromgml(@x, 0); SET @x = '<LineString xmlns="http://www.opengis.net/gml"> <poslist>3 2 2 0 0 3</posList> </LineString>'; SET @g = geometry::geomfromgml(@x, 0); SET @x ='<Point xmlns="http://www.opengis.net/gml"><pos>3 3</pos></Point>' SET @h = geometry::geomfromgml(@x, 0);.ToString(),@g.ToString(), @h.tostring(); POLYGON ((2 2, 3 1, 2 0, 2 2)) LINESTRING (3 2, 2 0, 0 3) POINT (3 3)

Spatial Data Metoda NULL Zwraca pustą instancję obiektu geometry SET @g = geometry::[null]; NULL

Spatial Data Metoda Parse() DECLARE @e geometry; DECLARE @a geometry; DECLARE @b geometry; DECLARE @c geometry; DECLARE @d geometry; SET @a = geometry::parse('point(5 7)'); Zwraca postać Well-Known Text (WKT) obiektu z postaci znakowej, jest odpowiednikiem STGeomFromText() ale nie pozwala przypisać identyfikatora SRID (domyślnie 0) SET @b = geometry::parse('multipoint(4 7, 11 5, 9 12, 8 8)'); SET @c = geometry::parse('linestring(5 6, 7 8, 11 3)'); SET @d = geometry::parse('multilinestring((11 5, 7 4, 3 9), (5 3, 2 7, 6 5))'); SET @e = geometry::parse('polygon((8 3, 8 8, 12 3, 8 3))'); SET @f = geometry::parse('multipolygon(((0 0, 5 5, 10 0, 0 0)), ((3 2, 5 1, 7 2, 3 2)))'); SELECT @a SELECT @b SELECT @c SELECT @d SELECT @e

Spatial Data Metoda Point() Tworzy obiekt typu Point SET @g = geometry::point(1, 2, 0);.ToString(); POINT (1 2)

Spatial Data

Spatial Data CREATE TABLE geometia ( ID int IDENTITY(1,1) NOT NULL, G geometry )

Spatial Data przygotowanie danych INSERT INTO geometria (G) VALUES ('LINESTRING(1 2, 4 1)'), ('LINESTRING(8 1, 9 3)'), ('LINESTRING(9 2, 7 3)'), ('LINESTRING(1 7, 2 9, 3 8, 6 9, 8 8, 9 9)'), ('POLYGON((1 3, 1 6, 6 6, 6 3, 1 3))'), ('POLYGON((5 4, 7 1, 9 4, 5 4))'), ('POLYGON((3 5, 3 7, 4 8, 7 8, 8 7, 8 5, 7 3, 4 3, 3 5))'), ('POLYGON((1 0, 1 8, 6 4, 1 0))'), ('POLYGON((4 1, 3 5, 4 9, 9 5, 4 1), (4 5, 5 7, 6 7, 4 4, 4 5))')

G Zawartość SELECT G FROM geometria 0x000000000114000000000000F03F00000000000000400000000000001040000000000000F03F 0x0000000001140000000000002040000000000000F03F00000000000022400000000000000840 0x000000000114000000000000224000000000000000400000000000001C400000000000000840 0x00000000010406000000000000000000F03F0000000000001C40000000000000004000000000000022400000 000000000840000000000000204000000000000018400000000000002240000000000000204000000000000020 400000000000002240000000000000224001000000010000000001000000FFFFFFFF00000000 0x00000000010405000000000000000000F03F0000000000000840000000000000F03F00000000000018400000 000000001840000000000000184000000000000018400000000000000840000000000000F03F00000000000008 4001000000020000000001000000FFFFFFFF0000000003 0x00000000010404000000000000000000144000000000000010400000000000001C40000000000000F03F0000 00000000224000000000000010400000000000001440000000000000104001000000020000000001000000FFFF FFFF0000000003 0x000000000104090000000000000000000840000000000000144000000000000008400000000000001C400000 00000000104000000000000020400000000000001C40000000000000204000000000000020400000000000001C 40000000000000204000000000000014400000000000001C4000000000000008400000000000 0x00000000010404000000000000000000F03F0000000000000000000000000000F03F00000000000020400000 0000000018400000000000001040000000000000F03F000000000000000001000000020000000001000000FFFF FFFF0000000003 0x0000000001040A0000000000000000001040000000000000F03F000000000000084000000000000014400000 0000000010400000000000002240000000000000224000000000000014400000000000001040000000000000F0 3F0000000000001040000000000000144000000000000014400000000000001C400000000000

Zawartość SELECT G FROM geometria

2012 DECLARE @a geometry; DECLARE @b geometry; DECLARE @c geometry; DECLARE @d geometry; DECLARE @e geometry; DECLARE @i geometry; SET @a = geometry::stpointfromtext('point(5 7)', 0); SET @b = geometry::stmpointfromtext('multipoint(4 7, 11 5, 9 12, 8 8)', 0); SET @c = geometry::stlinefromtext('linestring(5 6, 7 8, 11 3)', 0); SET @d = geometry::stmlinefromtext('multilinestring((11 5, 7 4, 3 9), (5 3, 2 7, 6 5))', 0); SET @e = geometry::stpolyfromtext('polygon((8 3, 8 8, 12 3, 8 3))', 0); SET @f = geometry::stmpolyfromtext('multipolygon(((0 0, 5 5, 10 0, 0 0)), ((3 2, 5 1, 7 2, 3 2)))', 0); SET @g = geometry::stgeomfromtext('circularstring(1 1, 2 0, 1 3, 1 1, 0 1)', 0); SET @h = geometry::stgeomfromtext('compoundcurve(circularstring(1 0, 0 1, -1 0), (-1 0, 2 0))', 0); SET @i = geometry::stgeomfromtext('curvepolygon(circularstring(-1 6, 1 8, 2 9, 5 6, -1 6),(1 6, 3 6, 3 8, 1 6))', 0); SELECT @a SELECT @b SELECT @c SELECT @d SELECT @e SELECT @i

SELECT [Miasto],geography::STGeomFromText('POINT('+ cast(dlugosc AS VARCHAR(22)) + ' '+ cast(szerokosc AS VARCHAR(22))+')',4326) AS MM FROM [KodyPocztowe_1] SELECT [NAME_ENGLI],[geom] FROM [POL_adm0]

DECLARE @add real=0.05 SELECT [Miasto], geography::stgeomfromtext('circularstring('+ cast(dlugosc- @add AS VARCHAR(22)) +' '+ cast(szerokosc AS VARCHAR(22))+', '+ + cast(dlugosc AS VARCHAR(22)) +' '+ cast(szerokosc + @add AS VARCHAR(22))+', '+ + cast(dlugosc+ @add AS VARCHAR(22)) +' '+ cast(szerokosc AS VARCHAR(22))+', '+ + cast(dlugosc AS VARCHAR(22)) +' '+ cast(szerokosc -@add AS VARCHAR(22))+', '+ + cast(dlugosc- @add AS VARCHAR(22)) +' '+ cast(szerokosc AS VARCHAR(22))+')',4326) AS MM FROM [KodyPocztowe_1] SELECT [NAME_ENGLI],[geom] FROM [POL_adm0]