Skip to content

Commit

Permalink
WMS 708 - updated markdown and fixed typos (#143)
Browse files Browse the repository at this point in the history
updated markdown and fixed typos
  • Loading branch information
denisemyrick authored Aug 23, 2024
1 parent df0c339 commit df19dda
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 61 deletions.
9 changes: 2 additions & 7 deletions spatial/cleanup/cleanup.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# Reset ADB to pre-workshop state


## Introduction

This lab is to remove everything created in the previous labs so that you can start over if needed.

Estimated Lab Time: 2 minutes


### About
### About

In this lab, all previously created artifacts are dropped.

Expand All @@ -18,15 +16,12 @@ In this lab, all previously created artifacts are dropped.

### Prerequisites

* Completion of Lab 3; Prepare Spatial Data
* Completion of Lab 3: Prepare Spatial Data

<!-- *This is the "fold" - below items are collapsed by default* -->



## Task 1: Remove everything created in this workshop


1. To remove tables and indexes created in this workshop, run the following using the run script button in SQL Worksheet.

![Image alt text](images/run-script.png)
Expand Down
30 changes: 7 additions & 23 deletions spatial/create-spatial-data-adb/create-spatial-data-adb.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,6 @@ Spatial data is commonly sourced from files having coordinates or place names, a

Estimated Time: 20 minutes

### Objectives

In this lab, you will:
* Learn about spatial data management in Oracle Database
* Prepare spatial data in Oracle Database from common file formats


### Prerequisites

* Completion of Lab 2: Connect to ADB with SQL Worksheet


### About spatial data

Oracle Database stores spatial data (points, lines, polygons) in a native data type called SDO_GEOMETRY. Oracle Database also provides a native spatial index for high performance spatial operations. This spatial index relies on spatial metadata that is entered for each table and geometry column storing spatial data. Once spatial data is populated and indexed, robust APIs are available to perform spatial analysis, calculations, and processing.
Expand All @@ -37,15 +25,15 @@ The SDO_GEOMETRY type has the following general format:
The most common geometry types are 2-dimensional:

| ID |Type |
| --- | --- |
| --- | --- |
| 2001 |Point |
| 2002 |Line |
| 2003 |Polygon |

The most common coordinate systems are:

| ID |Coordinate System |
| --- | --- |
| --- | --- |
| 4326 |Latitude/Longitude|
| 3857 |World Mercator|

Expand Down Expand Up @@ -99,7 +87,6 @@ Spatial metadata is inserted as follows:
);
```


In this workshop you work with longitude,latitude coordinates so the metadata inserts will be as follows:

```
Expand All @@ -113,9 +100,7 @@ In this workshop you work with longitude,latitude coordinates so the metadata in
);
```



For **point** data, the most common scenario is to start with data including coordinates representing point locations. The data may be configured either by creating and populating a new geometry column (column with type SDO_GEOMETRY), or creating a function that creates geometries from coordinates, and then creating a spatial index on that function. Both options have their associated use cases, and you will use both methods to gain familiarity.
For **point** data, the most common scenario is to start with data including coordinates representing point locations. The data may be configured either by creating and populating a new geometry column (column with type SDO_GEOMETRY), or creating a function that creates geometries from coordinates, and then creating a spatial index on that function. Both options have their associated use cases, and you will use both methods to gain familiarity.

For **lines** and **polygons**, it is most common to load from common formats, such as GeoJSON, and convert to a table with a geometry column. GeoJSON which is the most common format for developer integration, and since conversion from/to GeoJSON is included in this workshop, we provide the following brief introduction.

Expand Down Expand Up @@ -145,20 +130,19 @@ In this lab you will load data from GeoJSON documents to tables with SDO\_GEOMET
### Objectives

In this lab, you will:

* Download files for STORES, WAREHOUSES, REGIONS, and TORNADO\_PATHS
* View the content on a map
* Load the files to database tables
* Configure the tables for spatial analysis


### Prerequisites

Oracle Autonomous Database and Database Actions

* Completion of Lab 2: Connect to ADB with SQL Worksheet

## Task 1: Load data from files

You begin by loading data for warehouses and stores from CSV files that include coordinates which will be used to create point geometries. You then load data for regions and tornado paths from GeoJSON documents. The GeoJSON files will be loaded and converted to tables with geometries.
You begin by loading data for warehouses and stores from CSV files that include coordinates which will be used to create point geometries. You then load data for regions and tornado paths from GeoJSON documents. The GeoJSON files will be loaded and converted to tables with geometries.

1. Download the following files using **right-click > Save link As...**.

Expand Down Expand Up @@ -634,4 +618,4 @@ Now that conversion from GeoJSON is complete you may drop the tables storing the
* **Author** - David Lapp, Database Product Management, Oracle
* **Contributors** - Karin Patenge, Database Product Management, Oracle
* **Last Updated By/Date** - David Lapp, March 2023
* **Last Updated By/Date** - Denise Myrick, August 2024
10 changes: 5 additions & 5 deletions spatial/return-geojson/return-geojson.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

## Introduction

GeoJSON is the preferred format for developer integration of spatial data. Virtually all spatial and mapping client libraries consume GeoJSON. So it is important to return content and results from Spatial as GeoJSON. Please refer to **Lab 3 - Introduction** for an explanation of GeoJSON. In this lab you will generate GeoJSON documents from tables with geometries. In practice, the value of generating GeoJSON in ADB is in returning GeoJSON to diverse clients and that then deliver the content from their framework. For example, SQL and PL/SQL returning GeoJSON can be leveraged by Oracle REST Data Services (ORDS) to publish location-based REST APIs returning GeoJSON documents, and Oracle Data Science to combine with popular open source spatial ML libraries that natively support GeoJSON.
GeoJSON is the preferred format for developer integration of spatial data. Virtually all spatial and mapping client libraries consume GeoJSON. So it is important to return content and results from spatial as GeoJSON. Please refer to **Lab 3 - Prepare spatial data** for an explanation of GeoJSON. In this lab you will generate GeoJSON documents from tables with geometries. In practice, the value of generating GeoJSON in ADB is in returning GeoJSON to diverse clients and that then deliver the content from their framework. For example, SQL and PL/SQL returning GeoJSON can be leveraged by Oracle REST Data Services (ORDS) to publish location-based REST APIs returning GeoJSON documents, and Oracle Data Science to combine with popular open source spatial ML libraries that natively support GeoJSON.

Estimated Time: 15 minutes

Expand All @@ -13,13 +13,13 @@ Watch the video below for a quick walk-through of the lab.
### Objectives

In this lab, you will:
* Explore native JSON handing in Oracle Autonomous Database
* Convert tables with geometries to GeoJSON documents to support developer integration

* Explore native JSON handing in Oracle Autonomous Database
* Convert tables with geometries to GeoJSON documents to support developer integration

### Prerequisites

* Completion of Lab 3: Prepare Spatial Data
* Completion of Lab 3: Prepare spatial data

## Task 1: Construct GeoJSON document from query results

Expand Down Expand Up @@ -178,4 +178,4 @@ You may now **proceed to the next lab**.
## Acknowledgements
* **Author** - David Lapp, Database Product Management, Oracle
* **Last Updated By/Date** - David Lapp, September 2022
* **Last Updated By/Date** - Denise Myrick, August 2024
36 changes: 12 additions & 24 deletions spatial/run-spatial-queries-adb/run-spatial-queries-adb.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Spatial queries


## Introduction

This lab walks you through basic spatial queries in Oracle Autonomous Database. You will use the sample data created in the previous lab to identify items based on proximity and containment.
Expand All @@ -10,17 +9,6 @@ Estimated Time: 20 minutes
Watch the video below for a quick walk-through of the lab.
[Prepare spatial data](videohub:1_feaq2eu8)

### Objectives

In this lab, you will:
* Learn about and perform spatial queries in Oracle Database

### Prerequisites

* Completion of Lab 3: Prepare spatial data



### About spatial queries

Oracle Database includes a robust library of functions and operators for spatial analysis. This includes spatial relationships, measurements, aggregations, transformations, and more. These operations are accessible through native SQL, PL/SQL, Java APIs, and any other languages with connection modules to Oracle such as Python and Node.js.
Expand Down Expand Up @@ -49,7 +37,7 @@ AND B.NAME='MY_REGION-01';
</code>
```

Spatial Functions return a value and can be in the SELECT list or used in the WHERE clause. Generically as follows:
Spatial functions return a value and can be in the SELECT list or used in the WHERE clause. Generically as follows:

```
<code>
Expand All @@ -58,7 +46,7 @@ FROM [tables]
WHERE [conditions]
</code>
```

For example, to get the area of REGION-01 of MY\_REGIONS:

```
Expand All @@ -84,9 +72,10 @@ In this lab, you will perform spatial queries to identify the location relations



## Task 1: Proximity queries
## Task 1: Proximity queries

Proximity relates to how close items are to each other. The two main spatial proximity operators are

Proximity relates to how close items are to each other. The two main Spatial proximity operators are
* SDO\_WITH\_DISTANCE( ) returns items within a given distance of another item
* SDO\_NN( ) returns the nearest items to another item.

Expand All @@ -111,7 +100,7 @@ Proximity relates to how close items are to each other. The two main Spatial pro
![Proximity query](images/run-queries-01.png)
2. Identifying items nearest to another item is accomplished with the Spatial operator **SDO\_NN( )**, where NN stands for Nearest Neighbor. Run the following query to identify the 5 closest stores to the Dallas Warehouse. Again, notice that the first argument to **SDO\_NN( )** is the function that returns geometry, which has a function-based spatial index.
2. Identifying items nearest to another item is accomplished with the spatial operator **SDO\_NN( )**, where NN stands for Nearest Neighbor. Run the following query to identify the 5 closest stores to the Dallas Warehouse. Again, notice that the first argument to **SDO\_NN( )** is the function that returns geometry, which has a function-based spatial index.
```
<copy>
Expand Down Expand Up @@ -256,12 +245,11 @@ Proximity relates to how close items are to each other. The two main Spatial pro
## Task 2: Containment queries
Containment refers to identifying items that are contained by a specific region, and vice versa, identifying regions that contain specific items. The spatial main Spatial containment operators are
* SDO\_INSIDE( ) returns items that are inside region(s). Items on the boundary are not returned.
* SDO_CONTAINS( ) returns regions that contain item(s). Items on the boundary are not considered to be contained.
* SDO\_ANYINTERACT( ) returns items having any spatial relationship to other item(s), including items on a boundary or items partially contained such as a line that crosses into a region.
Containment refers to identifying items that are contained by a specific region, and vice versa, identifying regions that contain specific items. The main spatial containment operators are
* SDO\_INSIDE( ) returns items that are inside region(s). Items on the boundary are not returned.
* SDO_CONTAINS( ) returns regions that contain item(s). Items on the boundary are not considered to be contained.
* SDO\_ANYINTERACT( ) returns items having any spatial relationship to other item(s), including items on a boundary or items partially contained such as a line that crosses into a region.
1. Use SDO_INSIDE( ) to return stores in REGION-02, not including stores on the boundary.
Expand All @@ -282,7 +270,7 @@ Containment refers to identifying items that are contained by a specific region,
![Containment query](images/run-queries-09.png)
2. Use SDO_INSIDE( ) to return each store with the region it's contained by. This is another example of using a Spatial operator to perform a join, as you did previously with SDO\_NN( ). Note that stores on a region boundary are not included. To include stores on the boundary you would use SDO\_ANYINTERACT( ).
2. Use SDO_INSIDE( ) to return each store with the region it's contained by. This is another example of using a spatial operator to perform a join, as you did previously with SDO\_NN( ). Note that stores on a region boundary are not included. To include stores on the boundary you would use SDO\_ANYINTERACT( ).
```
<copy>
Expand Down Expand Up @@ -380,4 +368,4 @@ You may now **proceed to the next lab**.
* **Author** - David Lapp, Database Product Management, Oracle
* **Contributors** - Karin Patenge, Database Product Management, Oracle
* **Last Updated By/Date** - David Lapp, September 2022
* **Last Updated By/Date** - Denise Myrick, August 2024
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Estimated Workshop Time: 60 minutes

In this workshop you will create, configure, and analyze spatial data. You will create and configure spatial tables for STORES, WAREHOUSES, REGIONS, and TORNADO\_PATHS from common formats, and then perform spatial queries to explore their relationships based on proximity and containment. You finally transform results using native JSON support in ADB, for developer integration.

The ability to relate information based on location, such as relating data based on spatial proximity and containment, is extremely valuable in myriad scenarios. There is no pre-existing key that relates store locations to a warehouse. But Spatial enables such a relationship to be determined based on proximity. Similarly, there is no pre-existing relationship between store locations and regions, for example tax regions. But Spatial enables their relationship to be determined based on containment. Going further, Spatial enables location-based analytics such as summarizing information based on proximity; for example loss due to tornadoes within a distance from a location. Instead of performing these analyses in a separate system, you may leverage the built-in spatial features of ADB.
The ability to relate information based on location, such as relating data based on spatial proximity and containment, is extremely valuable in a myriad of scenarios. There is no pre-existing key that relates store locations to a warehouse. But Spatial enables such a relationship to be determined based on proximity. Similarly, there is no pre-existing relationship between store locations and regions, for example tax regions. But Spatial enables their relationship to be determined based on containment. Going further, Spatial enables location-based analytics such as summarizing information based on proximity; for example loss due to tornadoes within a distance from a location. Instead of performing these analyses in a separate system, you may leverage the built-in spatial features of ADB.

You will gain experience with all of the aforementioned capabilities in this workshop.

Expand All @@ -38,6 +38,6 @@ You will gain experience with all of the aforementioned capabilities in this wor

* **Author** - David Lapp, Database Product Management, Oracle
* **Contributors** - Karin Patenge, Database Product Management, Oracle
* **Last Updated By/Date** - David Lapp, September 2022
* **Last Updated By/Date** - Denise Myrick, August 2024


0 comments on commit df19dda

Please sign in to comment.