User:D-ECHO/Canada Land Cover: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
(first draft of a guide on how to use the Canadian Landcover the by the Canadian Government)
 
(extend a lot)
Line 14: Line 14:
Contains information licensed under the Open Government Licence – Canada.
Contains information licensed under the Open Government Licence – Canada.
</syntaxhighlight>
</syntaxhighlight>
== Obtaining ==
In order to download the data for the area of your interest, you need to find the index for said tile. The best way for this, in my experience, is to use the Index of available files available as a .kmz file to use in Google Earth. There you can see the index to download from [https://ftp.maps.canada.ca/pub/nrcan_rncan/vector/geobase_lcc_csc/shp_en/] as well as get the direct download link by clicking on the tile you want. The data comes in .zip files that need to be extracted before further use.
== Processing ==
=== Splitting the shapefile ===
Before being able to run ogr-decode on the data, the one big shapefile that comes as the download needs to be split into the different features (Town, Heath, Farmland etc.). The [https://ftp.maps.canada.ca/pub/nrcan_rncan/vector/geobase_lcc_csc/doc/GeoBase_lcc_en_Catalogue.pdf catalog] gives a good overview of the features along with their codes. The following, used as a linux shell script, will automatically create the required folders and split the main shapefile.
{{note|This script still has potential for improvement, the catalog can help in identifying features and trying to find the best [[FlightGear]] equivalent.}}
<syntaxhighlight lang="Bash">
mkdir lcc_water lcc_barrencover lcc_glacier lcc_rock lcc_developed lcc_heath lcc_scrub lcc_wetland lcc_herb lcc_grassland lcc_mixedcrop lcc_drycrop lcc_pasture lcc_deciduousforest lcc_evergreenforest lcc_mixedforest
for i in *.shp; do
ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE = '20'" lcc_water/lcc_water_$i.shp $i
ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE = '30'" lcc_barrencover/lcc_barrencover_$i.shp $i
ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE = '31'" lcc_glacier/lcc_glacier_$i.shp $i
ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE = '32'" lcc_rock/lcc_rock_$i.shp $i
ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE = '33'" lcc_barrencover/lcc_exposed_$i.shp $i
ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE = '34'" lcc_developed/lcc_developed_$i.shp $i
ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE = '35' OR COVTYPE = '36' OR COVTYPE = '37'" lcc_barrencover/lcc_sparseveg_$i.shp $i
ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE = '40'" lcc_heath/lcc_bryoids_$i.shp $i
ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE BETWEEN '50' AND '53'" lcc_scrub/lcc_scrub_$i.shp $i
ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE BETWEEN '80' AND '82'" lcc_wetland/wetland_$i.shp $i
ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE = '83' OR COVTYPE BETWEEN '100' AND '104'" lcc_herb/lcc_herb_$i.shp $i
ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE = '110'" lcc_grassland/lcc_grassland_$i.shp $i
ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE = '120'" lcc_mixedcrop/lcc_mixedcrop_$i.shp $i
ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE = '121'" lcc_drycrop/lcc_drycrop_$i.shp $i
ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE = '122'" lcc_pasture/lcc_pasture_$i.shp $i
ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE = '200' OR COVTYPE BETWEEN '220' AND '223'" lcc_deciduousforest/lcc_deciduousforest_$i.shp $i
ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE BETWEEN '210' AND '213'"  lcc_evergreenforest/lcc_evergreenforest_$i.shp $i
ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE BETWEEN '230' AND '233'"  lcc_mixedforest/lcc_mixedforest_$i.shp $i
done
</syntaxhighlight>
{{note|This script assumes that there are only Canada Land Cover type .shp files in the folder it is executed in.}}
=== Decoding the shapefiles ===
Assuming you have used the above script, the following processes the split shapefiles using ogr-decode:
<syntaxhighlight lang="Bash">
ogr-decode --all-threads --max-segment 500 --area-type Town work/Town lcc_developed           
ogr-decode --all-threads --max-segment 500 --area-type Pasture work/Pasture lcc_pasture
ogr-decode --all-threads --max-segment 500 --area-type MixedCrop work/MixedCrop lcc_mixedcrop
ogr-decode --all-threads --max-segment 500 --area-type MixedCrop work/MixedCrop lcc_drycrop
ogr-decode --all-threads --max-segment 500 --area-type DeciduousForest work/DeciduousForest lcc_deciduousforest
ogr-decode --all-threads --max-segment 500 --area-type EvergreenForest work/EvergreenForest lcc_evergreenforest
ogr-decode --all-threads --max-segment 500 --area-type MixedForest work/MixedForest lcc_mixedforest
ogr-decode --all-threads --max-segment 500 --area-type Grassland work/Grassland lcc_grassland
ogr-decode --all-threads --max-segment 500 --area-type Heath work/Heath lcc_heath
ogr-decode --all-threads --max-segment 500 --area-type Scrub work/Scrub lcc_scrub
ogr-decode --all-threads --max-segment 500 --area-type Rock work/Rock lcc_rock
ogr-decode --all-threads --max-segment 500 --area-type BarrenCover work/BarrenCover lcc_barrencover
ogr-decode --all-threads --max-segment 500 --area-type Glacier work/Glacier lcc_glacier
ogr-decode --all-threads --max-segment 500 --area-type Marsh work/Marsh lcc_wetland
ogr-decode --all-threads --max-segment 500 --area-type Lake work/Lake lcc_water
</syntaxhighlight>
Afterwards you can run ogr-decode as normal.
== Suggested additional data ==
Given the high accuracy of [[OSM]] Coastline data as well as the lack of linear features in Canada Land Cover data, the following features should be additionally used from OpenStreetMap:
* Default ( OSM Landmass, either from [https://osmdata.openstreetmap.de/data/land-polygons.html OSM Data Land Polygons] or extracted from your area's openstreetmap file with the tag natural=coastline/place=island/place=islet )
* Roads
* Rivers/Streams
Additionally, as Land Cover Canada is very unspecific about developed areas (there is only 33 Exposed Land and 34 Developed), you might want to use OSM data for
* Residential Areas
* Commercial Areas
* Industrial Areas
* Transportation Areas (railway, ports)
* Mines
* Landfills
depending on the quality of OSM coverage in your region of interest




<references />
<references />

Revision as of 17:45, 23 September 2020

The Government of Canada publishes a Landsat-based vector landcover product on their Open Government website. The following guide explains how to use this data to make custom scenery for FlightGear.

License Note

Note  Please note that the author of this guide is no law professional and thus the following is only a subjective interpretation of the information.

The website states that the data is available under the Open Government License - Canada, available here. This license, in my interpretation, allows to use the data for a scenery later released under the GPL v2+, as long as you Acknowledge the source of the Information by including any attribution statement specified by the Information Provider(s) and, where possible, provide a link to this licence.[1]. Furthermore, it states that the statement Contains information licensed under the Open Government Licence – Canada. shall be used, when there is no specific attribution statement given.[2]. Given that I couldn't find any specific attribution statement on the product's website, I use the following statement in the scenery's README.md files in order to comply with the license requirements:

Following sources have been used:
(...)
* Landcover Data from Canadian Land Cover, Circa 2000 (Vector) - GeoBase Series, 1996-2005
	available under: https://open.canada.ca/data/en/dataset/97126362-5a85-4fe0-9dc2-915464cfdbb7 
	released under the Open Government License - Canada (https://open.canada.ca/en/open-government-licence-canada)
		Contains information licensed under the Open Government Licence – Canada.

Obtaining

In order to download the data for the area of your interest, you need to find the index for said tile. The best way for this, in my experience, is to use the Index of available files available as a .kmz file to use in Google Earth. There you can see the index to download from [3] as well as get the direct download link by clicking on the tile you want. The data comes in .zip files that need to be extracted before further use.

Processing

Splitting the shapefile

Before being able to run ogr-decode on the data, the one big shapefile that comes as the download needs to be split into the different features (Town, Heath, Farmland etc.). The catalog gives a good overview of the features along with their codes. The following, used as a linux shell script, will automatically create the required folders and split the main shapefile.

Note  This script still has potential for improvement, the catalog can help in identifying features and trying to find the best FlightGear equivalent.
mkdir lcc_water lcc_barrencover lcc_glacier lcc_rock lcc_developed lcc_heath lcc_scrub lcc_wetland lcc_herb lcc_grassland lcc_mixedcrop lcc_drycrop lcc_pasture lcc_deciduousforest lcc_evergreenforest lcc_mixedforest
for i in *.shp; do
	ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE = '20'" lcc_water/lcc_water_$i.shp $i
	ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE = '30'" lcc_barrencover/lcc_barrencover_$i.shp $i
	ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE = '31'" lcc_glacier/lcc_glacier_$i.shp $i
	ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE = '32'" lcc_rock/lcc_rock_$i.shp $i
	ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE = '33'" lcc_barrencover/lcc_exposed_$i.shp $i
	ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE = '34'" lcc_developed/lcc_developed_$i.shp $i
	ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE = '35' OR COVTYPE = '36' OR COVTYPE = '37'" lcc_barrencover/lcc_sparseveg_$i.shp $i
	ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE = '40'" lcc_heath/lcc_bryoids_$i.shp $i
	ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE BETWEEN '50' AND '53'" lcc_scrub/lcc_scrub_$i.shp $i
	ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE BETWEEN '80' AND '82'" lcc_wetland/wetland_$i.shp $i
	ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE = '83' OR COVTYPE BETWEEN '100' AND '104'" lcc_herb/lcc_herb_$i.shp $i
	ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE = '110'" lcc_grassland/lcc_grassland_$i.shp $i
	ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE = '120'" lcc_mixedcrop/lcc_mixedcrop_$i.shp $i
	ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE = '121'" lcc_drycrop/lcc_drycrop_$i.shp $i
	ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE = '122'" lcc_pasture/lcc_pasture_$i.shp $i
	ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE = '200' OR COVTYPE BETWEEN '220' AND '223'" lcc_deciduousforest/lcc_deciduousforest_$i.shp $i
	ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE BETWEEN '210' AND '213'"  lcc_evergreenforest/lcc_evergreenforest_$i.shp $i
	ogr2ogr -f "ESRI Shapefile"  -where "COVTYPE BETWEEN '230' AND '233'"  lcc_mixedforest/lcc_mixedforest_$i.shp $i
done
Note  This script assumes that there are only Canada Land Cover type .shp files in the folder it is executed in.

Decoding the shapefiles

Assuming you have used the above script, the following processes the split shapefiles using ogr-decode:

ogr-decode --all-threads --max-segment 500 --area-type Town work/Town lcc_developed             
ogr-decode --all-threads --max-segment 500 --area-type Pasture work/Pasture lcc_pasture
ogr-decode --all-threads --max-segment 500 --area-type MixedCrop work/MixedCrop lcc_mixedcrop
ogr-decode --all-threads --max-segment 500 --area-type MixedCrop work/MixedCrop lcc_drycrop
ogr-decode --all-threads --max-segment 500 --area-type DeciduousForest work/DeciduousForest lcc_deciduousforest
ogr-decode --all-threads --max-segment 500 --area-type EvergreenForest work/EvergreenForest lcc_evergreenforest
ogr-decode --all-threads --max-segment 500 --area-type MixedForest work/MixedForest lcc_mixedforest
ogr-decode --all-threads --max-segment 500 --area-type Grassland work/Grassland lcc_grassland
ogr-decode --all-threads --max-segment 500 --area-type Heath work/Heath lcc_heath
ogr-decode --all-threads --max-segment 500 --area-type Scrub work/Scrub lcc_scrub
ogr-decode --all-threads --max-segment 500 --area-type Rock work/Rock lcc_rock
ogr-decode --all-threads --max-segment 500 --area-type BarrenCover work/BarrenCover lcc_barrencover
ogr-decode --all-threads --max-segment 500 --area-type Glacier work/Glacier lcc_glacier
ogr-decode --all-threads --max-segment 500 --area-type Marsh work/Marsh lcc_wetland
ogr-decode --all-threads --max-segment 500 --area-type Lake work/Lake lcc_water

Afterwards you can run ogr-decode as normal.

Suggested additional data

Given the high accuracy of OSM Coastline data as well as the lack of linear features in Canada Land Cover data, the following features should be additionally used from OpenStreetMap:

  • Default ( OSM Landmass, either from OSM Data Land Polygons or extracted from your area's openstreetmap file with the tag natural=coastline/place=island/place=islet )
  • Roads
  • Rivers/Streams

Additionally, as Land Cover Canada is very unspecific about developed areas (there is only 33 Exposed Land and 34 Developed), you might want to use OSM data for

  • Residential Areas
  • Commercial Areas
  • Industrial Areas
  • Transportation Areas (railway, ports)
  • Mines
  • Landfills

depending on the quality of OSM coverage in your region of interest