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
GeoTrellis needs to know where to find data in order to perform it's magic. One way you can tell GeoTrellis where to find rasters is to use the [io.LoadFile operation](http://geotrellis.github.io/scaladocs/0.8/#geotrellis.io.LoadFile). Another way is to create a .json file called a *catalog*. This file tells the GeoTrellis system how to find Rasters that are referred to by name. The raster's name is declared in the [.json metadata file for the ARG as the 'layer' attribute](https://github.com/geotrellis/geotrellis/blob/0.8.1/src/test/resources/sbn/SBN_co_phila.json#L7). Any arg file that is contained in a Data Store declared by the catalog is available to be loaded by GeoTrellis through the [io.LoadRaster](http://geotrellis.github.io/scaladocs/0.8/#geotrellis.io.LoadRaster) operation.
24
+
25
+
#### Why use a Catalog?
26
+
27
+
Using the Raster's name to load it into GeoTrellis allows for flexibility in the file storage of your raster data. Code that can run on one set of data can be moved to work with another set, just by changing where the catalog is pointing. Also, using a simple name to refer to raster layers allows for REST calls to include the layer name in query parameters. This lets the client be able to easily declare what server side data to operate on. If you're making a web map that has multiple raster layers, you can dynamically make calls out to GeoTrellis on any one or all the layers by passing through the name of the rasters. For an example of this, see the [admin tool's WMS call](https://github.com/geotrellis/geotrellis/blob/0.8.1/server/src/main/scala/geotrellis/admin/services/Layer.scala#L44).
Copy file name to clipboardExpand all lines: tutorials/geotiff.md
+10-6Lines changed: 10 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,30 +16,34 @@ The first thing we're going to do is download one of the archives and see what i
16
16
17
17
#### Converting to ARG format
18
18
19
-
To be able to work with Rasters in GeoTrellis, they need to be in the [ARG file format](https://github.com/geotrellis/geotrellis/wiki/ARG-Specification). The way we can do this is using the gt-tool script. You can download the gt-tool script from the [GeoTrellis scripts folder](https://raw.github.com/geotrellis/geotrellis/master/scripts/gt-tool), or in the root folder of the code for this tutorial. We can convert our GeoTIFF to an ARG using the geotiff_convert subcommand:
19
+
To be able to work with Rasters in GeoTrellis, they need to be in the [ARG file format](https://github.com/geotrellis/geotrellis/wiki/ARG-Specification). The way we can do this is using the gt-tool script. You can download the gt-tool script from the [GeoTrellis scripts folder](https://raw.github.com/geotrellis/geotrellis/master/scripts/gt-tool), or you can use the one in the root folder of the code for this tutorial. We can convert our GeoTIFF to an ARG using the geotiff_convert subcommand:
This will produce two files: the philly_ned.arg data file and philly_ned.json metadata file. We need to drop this in a folder that is stated in our GeoTrellis catalog. In the code for this tutorial, the catalog is located in the ```data``` folder, and points to the ```data/ned```, which does not exist in the repository initially. Create that folder and drop the ARG files in.
23
+
This will produce two files: the philly_ned.arg data file and philly_ned.json metadata file.
24
+
25
+
#### Telling GeoTrellis about the Raster
26
+
27
+
To perform operations on this Raster using GeoTrellis, we need to let GeoTrellis know about the .arg and .json file that we just created. To do that, we drop the files into a folder that is declared in our [GeoTrellis catalog]( {{ site.base }}/overviews/thecatalog.html). In the code for this tutorial, the catalog is located in the ```data``` folder, and points to the ```data/ned```, which does not exist in the repository initially. We need to create that folder and move the ARG files (both the .arg and .json) into it.
24
28
25
29
#### First Viewing
26
30
27
31
Run the GeoTrellis server by running the ```./sbt run``` command in the root directory of the code project. You'll then be able to go to http://localhost:8880/admin to see the Philadelphia NED data using the GeoTrellis admin tool. You should see something like this:
You might be able to recognize the shape of Philadelphia, but the raster is clearly in the wrong spot. This is because the GeoTrellis admin tool displays the rasters in the Web Mercator (ESPG:3857) projection. If the raster is not in this projection, you will still be able to see the raster, but it won't be placed correctly. However, if we want to view the raster properly on the map, we can use GDAL to reproject the raster into Web Mercator.
35
+
You might be able to recognize the shape of Philadelphia, but the raster is clearly in the wrong spot. This is because the GeoTrellis admin tool displays the rasters in the Web Mercator (ESPG:3857) projection. If the raster is not in this projection, you will still be able to see the raster, but it won't be placed correctly. If we want to view the raster properly on the map, we can use GDAL to reproject the raster into Web Mercator.
32
36
33
-
#### Reprojecting with gdal_warp
37
+
#### Reprojecting with gdal warp
34
38
35
39
This step requires that you have [GDAL](http://www.gdal.org/) installed. For a script to build and install gdal on Ubuntu, see [this gist](https://gist.github.com/lossyrob/4348503).
36
40
37
-
To reproject the original GeoTIFF raster, we run the gdal_warp on our raster:
41
+
To reproject the original GeoTIFF raster, we run the gdalwarp on our raster:
This will reproject the raster to the proper projection. We can now use gt-tool to convert the GeoTIFF into ARG format, and view it through GeoTrellis on the proper part of the map.
42
46
43
47
#### Getting more data
44
48
45
-
Included in the codebase is a python script that will download all the data available for Pennsylvania NED data. Running it will populate the catalog with a set of rasters that gives the elevation of various points in PA. It simply downloads the archive, reprojects the GeoTIFF file, and converts it to an ARG file.
49
+
Included in the codebase is a python script that will download all the data available for Pennsylvania NED data. Running the script will populate the catalog with a set of rasters that represent the elevation of all points in PA. It simply downloads the archive, reprojects the GeoTIFF file, and converts it to an ARG file for each tile, as we did with the one above.
0 commit comments