You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/current/v23.1/spatial-tutorial.md
-4Lines changed: 0 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -15,10 +15,6 @@ In this tutorial, you will plan a vacation from New York City to the [Adirondack
15
15
+ Performing [joins]({% link {{ page.version.version }}/joins.md %}) on spatial data, and using [`EXPLAIN`]({% link {{ page.version.version }}/explain.md %}) to make sure indexes are effective.
16
16
+ Visualizing the output of your queries using free tools like <https://geojson.io>
17
17
18
-
<divclass="clearfix">
19
-
<aclass="btn btn-outline-primary"href="https://www.cockroachlabs.com/docs/tutorials/demo-spatial-tutorial-interactive"target="_blank"rel="noopener">Run this in your browser →</a>
20
-
</div>
21
-
22
18
## Step 1. Review the scenario
23
19
24
20
You live in New York City and are an avid birdwatcher and reader of books. You are going on a vacation up to the [Adirondack Mountains](https://visitadirondacks.com/about) in northern New York State. Although you are interested in many bird species, you are most interested in seeing (and [hearing](https://macaulaylibrary.org/asset/107964)) the <ahref="https://ebird.org/species/comloo"data-proofer-ignore>Common Loon</a>, a bird that can be found near the lakes and ponds of the north woods.
Copy file name to clipboardExpand all lines: src/current/v23.2/spatial-tutorial.md
-4Lines changed: 0 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -15,10 +15,6 @@ In this tutorial, you will plan a vacation from New York City to the [Adirondack
15
15
+ Performing [joins]({% link {{ page.version.version }}/joins.md %}) on spatial data, and using [`EXPLAIN`]({% link {{ page.version.version }}/explain.md %}) to make sure indexes are effective.
16
16
+ Visualizing the output of your queries using free tools like <https://geojson.io>
17
17
18
-
<divclass="clearfix">
19
-
<aclass="btn btn-outline-primary"href="https://www.cockroachlabs.com/docs/tutorials/demo-spatial-tutorial-interactive"target="_blank"rel="noopener">Run this in your browser →</a>
20
-
</div>
21
-
22
18
## Step 1. Review the scenario
23
19
24
20
You live in New York City and are an avid birdwatcher and reader of books. You are going on a vacation up to the [Adirondack Mountains](https://visitadirondacks.com/about) in northern New York State. Although you are interested in many bird species, you are most interested in seeing (and [hearing](https://macaulaylibrary.org/asset/107964)) the <ahref="https://ebird.org/species/comloo"data-proofer-ignore>Common Loon</a>, a bird that can be found near the lakes and ponds of the north woods.
Copy file name to clipboardExpand all lines: src/current/v24.1/spatial-tutorial.md
-4Lines changed: 0 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -15,10 +15,6 @@ In this tutorial, you will plan a vacation from New York City to the [Adirondack
15
15
+ Performing [joins]({% link {{ page.version.version }}/joins.md %}) on spatial data, and using [`EXPLAIN`]({% link {{ page.version.version }}/explain.md %}) to make sure indexes are effective.
16
16
+ Visualizing the output of your queries using free tools like <https://geojson.io>
17
17
18
-
<divclass="clearfix">
19
-
<aclass="btn btn-outline-primary"href="https://www.cockroachlabs.com/docs/tutorials/demo-spatial-tutorial-interactive"target="_blank"rel="noopener">Run this in your browser →</a>
20
-
</div>
21
-
22
18
## Step 1. Review the scenario
23
19
24
20
You live in New York City and are an avid birdwatcher and reader of books. You are going on a vacation up to the [Adirondack Mountains](https://visitadirondacks.com/about) in northern New York State. Although you are interested in many bird species, you are most interested in seeing (and [hearing](https://macaulaylibrary.org/asset/107964)) the <ahref="https://ebird.org/species/comloo"data-proofer-ignore>Common Loon</a>, a bird that can be found near the lakes and ponds of the north woods.
Copy file name to clipboardExpand all lines: src/current/v24.2/spatial-tutorial.md
-4Lines changed: 0 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -15,10 +15,6 @@ In this tutorial, you will plan a vacation from New York City to the [Adirondack
15
15
+ Performing [joins]({% link {{ page.version.version }}/joins.md %}) on spatial data, and using [`EXPLAIN`]({% link {{ page.version.version }}/explain.md %}) to make sure indexes are effective.
16
16
+ Visualizing the output of your queries using free tools like <https://geojson.io>
17
17
18
-
<divclass="clearfix">
19
-
<aclass="btn btn-outline-primary"href="https://www.cockroachlabs.com/docs/tutorials/demo-spatial-tutorial-interactive"target="_blank"rel="noopener">Run this in your browser →</a>
20
-
</div>
21
-
22
18
## Step 1. Review the scenario
23
19
24
20
You live in New York City and are an avid birdwatcher and reader of books. You are going on a vacation up to the [Adirondack Mountains](https://visitadirondacks.com/about) in northern New York State. Although you are interested in many bird species, you are most interested in seeing (and [hearing](https://macaulaylibrary.org/asset/107964)) the <ahref="https://ebird.org/species/comloo"data-proofer-ignore>Common Loon</a>, a bird that can be found near the lakes and ponds of the north woods.
Copy file name to clipboardExpand all lines: src/current/v24.3/spatial-tutorial.md
+6-10Lines changed: 6 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -15,10 +15,6 @@ In this tutorial, you will plan a vacation from New York City to the [Adirondack
15
15
+ Performing [joins]({% link {{ page.version.version }}/joins.md %}) on spatial data, and using [`EXPLAIN`]({% link {{ page.version.version }}/explain.md %}) to make sure indexes are effective.
16
16
+ Visualizing the output of your queries using free tools like <https://geojson.io>
17
17
18
-
<divclass="clearfix">
19
-
<aclass="btn btn-outline-primary"href="https://www.cockroachlabs.com/docs/tutorials/demo-spatial-tutorial-interactive"target="_blank"rel="noopener">Run this in your browser →</a>
20
-
</div>
21
-
22
18
## Step 1. Review the scenario
23
19
24
20
You live in New York City and are an avid birdwatcher and reader of books. You are going on a vacation up to the [Adirondack Mountains](https://visitadirondacks.com/about) in northern New York State. Although you are interested in many bird species, you are most interested in seeing (and [hearing](https://macaulaylibrary.org/asset/107964)) the <ahref="https://ebird.org/species/comloo"data-proofer-ignore>Common Loon</a>, a bird that can be found near the lakes and ponds of the north woods.
@@ -162,7 +158,7 @@ FROM
162
158
163
159
Paste the result above into <https://geojson.io> and you should see the following map, with gray markers for each loon sighting from the bird survey.
164
160
165
-
<img src="{{ 'images/v24.2/geospatial/tutorial/query-01.png' | relative_url }}" alt="Common Loon sightings in the years 2000-2019 in NY state" style="max-width:100%" />
161
+
<img src="{{ 'images/v24.3/geospatial/tutorial/query-01.png' | relative_url }}" alt="Common Loon sightings in the years 2000-2019 in NY state" style="max-width:100%" />
166
162
167
163
### (2) What is the total area of Loon sightings?
168
164
@@ -565,7 +561,7 @@ WHERE
565
561
566
562
Paste the result above into <https://geojson.io> and you should see the following map:
567
563
568
-
<imgsrc="{{ 'images/v24.2/geospatial/tutorial/query-09.png' | relative_url }}"alt="Convex hull of bookstore locations within Common Loon habitat"style="max-width:100%" />
564
+
<imgsrc="{{ 'images/v24.3/geospatial/tutorial/query-09.png' | relative_url }}"alt="Convex hull of bookstore locations within Common Loon habitat"style="max-width:100%" />
569
565
570
566
### (10) What is the area of the shape of all bookstore locations that are in the Loon's habitat range within NY state?
571
567
@@ -706,7 +702,7 @@ The result is a very large chunk of JSON:
706
702
707
703
Paste the result above into <https://geojson.io> and you should see the following map:
708
704
709
-
<imgsrc="{{ 'images/v24.2/geospatial/tutorial/query-12.png' | relative_url }}"alt="What does the route from Mysteries on Main Street in Johnstown, NY to The Book Nook in Saranac Lake, NY look like?"style="max-width:100%" />
705
+
<imgsrc="{{ 'images/v24.3/geospatial/tutorial/query-12.png' | relative_url }}"alt="What does the route from Mysteries on Main Street in Johnstown, NY to The Book Nook in Saranac Lake, NY look like?"style="max-width:100%" />
710
706
711
707
### (13) What were the 25 most-commonly-sighted birds in 2019 within 10 miles of the route between Mysteries on Main Street in Johnstown, NY and The Bookstore Plus in Lake Placid, NY?
712
708
@@ -1691,7 +1687,7 @@ The `tutorial` database contains the following tables:
1691
1687
1692
1688
Below is an entity-relationship diagram showing the `bookstores` and `bookstore_routes` tables (generated using [DBeaver]({% link {{ page.version.version }}/dbeaver.md %})):
1693
1689
1694
-
<imgsrc="{{ 'images/v24.2/geospatial/tutorial/er-bookstores.png' | relative_url }}"alt="tutorial.bookstores and tutorial.bookstore_routes ER diagrams"style="max-width:100%" />
1690
+
<imgsrc="{{ 'images/v24.3/geospatial/tutorial/er-bookstores.png' | relative_url }}"alt="tutorial.bookstores and tutorial.bookstore_routes ER diagrams"style="max-width:100%" />
1695
1691
1696
1692
As mentioned above, the `bookstores` table was created by scraping web data from the [American Booksellers Association website's member directory](https://bookweb.org/member_directory/search/ABAmember). In addition, the `geom` column was constructed by doing some [address geocoding](https://wikipedia.org/wiki/Address_geocoding) that converted each bookstore's address to a lon/lat pair and converted to a spatial object using `ST_MakePoint`. For each bookstore, the script did a bit of parsing and geocoding and ran essentially the following query:
1697
1693
@@ -1755,7 +1751,7 @@ There are multiple ways to do geocoding. You can use REST API-based services or
1755
1751
1756
1752
Meanwhile, the `roads` table has many columns; the most important ones used in this tutorial are `state`, `geom`, `miles`, and `prime_name` (the human-readable name of the road).
1757
1753
1758
-
<imgsrc="{{ 'images/v24.2/geospatial/tutorial/er-roads.png' | relative_url }}"alt="tutorial.roads ER diagrams"style="max-width:100%" />
1754
+
<imgsrc="{{ 'images/v24.3/geospatial/tutorial/er-roads.png' | relative_url }}"alt="tutorial.roads ER diagrams"style="max-width:100%" />
1759
1755
1760
1756
For more information about what the other columns in `roads` mean, see the [full data set description](https://www.sciencebase.gov/catalog/file/get/581d052be4b08da350d524ce?f=__disk__60%2F6b%2F4e%2F606b4e564884da8cca57ffeb229cd817006616e0&transform=1&allowOpen=true).
1761
1757
@@ -1773,7 +1769,7 @@ The tables in the `birds` database are diagrammed below:
1773
1769
-`routes` is a list of ~130 prescribed locations that the birdwatchers helping with the survey visit each year. The `geom` associated with each route is a [Point]({% link {{ page.version.version }}/point.md %}) marking the latitude and longitude of the route's starting point. For details, see the [schema](https://www.sciencebase.gov/catalog/file/get/5ea04e9a82cefae35a129d65?f=__disk__b4%2F2f%2Fcf%2Fb42fcfe28a799db6e8c97200829ea1ebaccbf8ea&transform=1&allowOpen=true) (search for the text "routes.csv").
1774
1770
-`observations` describes the ~85,000 times and places in which birds of various species were actually seen. The `bird_id` is a [foreign key]({% link {{ page.version.version }}/foreign-key.md %}) to the ID in the `birds` table, and the `route_id` points to the ID of the `routes` table.
1775
1771
1776
-
<imgsrc="{{ 'images/v24.2/geospatial/tutorial/er-birds.png' | relative_url }}"alt="birds.birds, birds.routes, and birds.observations ER diagrams"style="max-width:100%" />
1772
+
<imgsrc="{{ 'images/v24.3/geospatial/tutorial/er-birds.png' | relative_url }}"alt="birds.birds, birds.routes, and birds.observations ER diagrams"style="max-width:100%" />
1777
1773
1778
1774
Each of these tables were populated using a script that parsed [the CSV files available for download](https://www.sciencebase.gov/catalog/item/52b1dfa8e4b0d9b325230cd9) and added the data using [`INSERT`]({% link {{ page.version.version }}/insert.md %}) statements. For the `routes` table, once again the `ST_MakePoint` function was used to create a geometry from the lon/lat values in the CSV as follows:
Copy file name to clipboardExpand all lines: src/current/v25.1/spatial-tutorial.md
+6-10Lines changed: 6 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -15,10 +15,6 @@ In this tutorial, you will plan a vacation from New York City to the [Adirondack
15
15
+ Performing [joins]({% link {{ page.version.version }}/joins.md %}) on spatial data, and using [`EXPLAIN`]({% link {{ page.version.version }}/explain.md %}) to make sure indexes are effective.
16
16
+ Visualizing the output of your queries using free tools like <https://geojson.io>
17
17
18
-
<divclass="clearfix">
19
-
<aclass="btn btn-outline-primary"href="https://www.cockroachlabs.com/docs/tutorials/demo-spatial-tutorial-interactive"target="_blank"rel="noopener">Run this in your browser →</a>
20
-
</div>
21
-
22
18
## Step 1. Review the scenario
23
19
24
20
You live in New York City and are an avid birdwatcher and reader of books. You are going on a vacation up to the [Adirondack Mountains](https://visitadirondacks.com/about) in northern New York State. Although you are interested in many bird species, you are most interested in seeing (and [hearing](https://macaulaylibrary.org/asset/107964)) the <ahref="https://ebird.org/species/comloo"data-proofer-ignore>Common Loon</a>, a bird that can be found near the lakes and ponds of the north woods.
@@ -162,7 +158,7 @@ FROM
162
158
163
159
Paste the result above into <https://geojson.io> and you should see the following map, with gray markers for each loon sighting from the bird survey.
164
160
165
-
<img src="{{ 'images/v24.2/geospatial/tutorial/query-01.png' | relative_url }}" alt="Common Loon sightings in the years 2000-2019 in NY state" style="max-width:100%" />
161
+
<img src="{{ 'images/v25.1/geospatial/tutorial/query-01.png' | relative_url }}" alt="Common Loon sightings in the years 2000-2019 in NY state" style="max-width:100%" />
166
162
167
163
### (2) What is the total area of Loon sightings?
168
164
@@ -565,7 +561,7 @@ WHERE
565
561
566
562
Paste the result above into <https://geojson.io> and you should see the following map:
567
563
568
-
<imgsrc="{{ 'images/v24.2/geospatial/tutorial/query-09.png' | relative_url }}"alt="Convex hull of bookstore locations within Common Loon habitat"style="max-width:100%" />
564
+
<imgsrc="{{ 'images/v25.1/geospatial/tutorial/query-09.png' | relative_url }}"alt="Convex hull of bookstore locations within Common Loon habitat"style="max-width:100%" />
569
565
570
566
### (10) What is the area of the shape of all bookstore locations that are in the Loon's habitat range within NY state?
571
567
@@ -706,7 +702,7 @@ The result is a very large chunk of JSON:
706
702
707
703
Paste the result above into <https://geojson.io> and you should see the following map:
708
704
709
-
<imgsrc="{{ 'images/v24.2/geospatial/tutorial/query-12.png' | relative_url }}"alt="What does the route from Mysteries on Main Street in Johnstown, NY to The Book Nook in Saranac Lake, NY look like?"style="max-width:100%" />
705
+
<imgsrc="{{ 'images/v25.1/geospatial/tutorial/query-12.png' | relative_url }}"alt="What does the route from Mysteries on Main Street in Johnstown, NY to The Book Nook in Saranac Lake, NY look like?"style="max-width:100%" />
710
706
711
707
### (13) What were the 25 most-commonly-sighted birds in 2019 within 10 miles of the route between Mysteries on Main Street in Johnstown, NY and The Bookstore Plus in Lake Placid, NY?
712
708
@@ -1691,7 +1687,7 @@ The `tutorial` database contains the following tables:
1691
1687
1692
1688
Below is an entity-relationship diagram showing the `bookstores` and `bookstore_routes` tables (generated using [DBeaver]({% link {{ page.version.version }}/dbeaver.md %})):
1693
1689
1694
-
<imgsrc="{{ 'images/v24.2/geospatial/tutorial/er-bookstores.png' | relative_url }}"alt="tutorial.bookstores and tutorial.bookstore_routes ER diagrams"style="max-width:100%" />
1690
+
<imgsrc="{{ 'images/v25.1/geospatial/tutorial/er-bookstores.png' | relative_url }}"alt="tutorial.bookstores and tutorial.bookstore_routes ER diagrams"style="max-width:100%" />
1695
1691
1696
1692
As mentioned above, the `bookstores` table was created by scraping web data from the [American Booksellers Association website's member directory](https://bookweb.org/member_directory/search/ABAmember). In addition, the `geom` column was constructed by doing some [address geocoding](https://wikipedia.org/wiki/Address_geocoding) that converted each bookstore's address to a lon/lat pair and converted to a spatial object using `ST_MakePoint`. For each bookstore, the script did a bit of parsing and geocoding and ran essentially the following query:
1697
1693
@@ -1755,7 +1751,7 @@ There are multiple ways to do geocoding. You can use REST API-based services or
1755
1751
1756
1752
Meanwhile, the `roads` table has many columns; the most important ones used in this tutorial are `state`, `geom`, `miles`, and `prime_name` (the human-readable name of the road).
1757
1753
1758
-
<imgsrc="{{ 'images/v24.2/geospatial/tutorial/er-roads.png' | relative_url }}"alt="tutorial.roads ER diagrams"style="max-width:100%" />
1754
+
<imgsrc="{{ 'images/v25.1/geospatial/tutorial/er-roads.png' | relative_url }}"alt="tutorial.roads ER diagrams"style="max-width:100%" />
1759
1755
1760
1756
For more information about what the other columns in `roads` mean, see the [full data set description](https://www.sciencebase.gov/catalog/file/get/581d052be4b08da350d524ce?f=__disk__60%2F6b%2F4e%2F606b4e564884da8cca57ffeb229cd817006616e0&transform=1&allowOpen=true).
1761
1757
@@ -1773,7 +1769,7 @@ The tables in the `birds` database are diagrammed below:
1773
1769
-`routes` is a list of ~130 prescribed locations that the birdwatchers helping with the survey visit each year. The `geom` associated with each route is a [Point]({% link {{ page.version.version }}/point.md %}) marking the latitude and longitude of the route's starting point. For details, see the [schema](https://www.sciencebase.gov/catalog/file/get/5ea04e9a82cefae35a129d65?f=__disk__b4%2F2f%2Fcf%2Fb42fcfe28a799db6e8c97200829ea1ebaccbf8ea&transform=1&allowOpen=true) (search for the text "routes.csv").
1774
1770
-`observations` describes the ~85,000 times and places in which birds of various species were actually seen. The `bird_id` is a [foreign key]({% link {{ page.version.version }}/foreign-key.md %}) to the ID in the `birds` table, and the `route_id` points to the ID of the `routes` table.
1775
1771
1776
-
<imgsrc="{{ 'images/v24.2/geospatial/tutorial/er-birds.png' | relative_url }}"alt="birds.birds, birds.routes, and birds.observations ER diagrams"style="max-width:100%" />
1772
+
<imgsrc="{{ 'images/v25.1/geospatial/tutorial/er-birds.png' | relative_url }}"alt="birds.birds, birds.routes, and birds.observations ER diagrams"style="max-width:100%" />
1777
1773
1778
1774
Each of these tables were populated using a script that parsed [the CSV files available for download](https://www.sciencebase.gov/catalog/item/52b1dfa8e4b0d9b325230cd9) and added the data using [`INSERT`]({% link {{ page.version.version }}/insert.md %}) statements. For the `routes` table, once again the `ST_MakePoint` function was used to create a geometry from the lon/lat values in the CSV as follows:
0 commit comments