Skip to content

External Data

kpruhs edited this page Apr 2, 2013 · 4 revisions

External Data Requirements:

iTree Resource Values

Each iTree region has a ResourceUnit spreadsheet in iTree's data files. This spreadsheet contains base data for calculating environmental benefits for each tree based on species and trunk diameter. OpenTreeMap includes a python script for importing the data in this spreadsheet.

To use this script:

  1. Enter the word 'code' without quotes into each data worksheet's A1 cell.
  2. Save each data worksheet as a csv file
  3. Run manage.py itree_import <filename>.csv <database_column> for each csv file

Environmental Benefit Values

OpenTreeMap requires cost values for 10 benefits trees bring to the urban landscape. Defaults for each region can be found in iTree's data files, however you may be able to locate more accurate data for your specific city or area. Enter the following values in the "treemap_benefitvalues" table.

  • Stormwater - $/gallon
  • Electricity - $/kWh
  • Natural Gas - $/therm
  • Co2 - $/lb
  • Ozone - $/lb
  • NOx - $/lb
  • PM10 - $/lb
  • SOX - $/lb
  • VOC - $/lb
  • BVOX - $/lb

Species data

Generate a list of species in your area and match each to a USDA symbol from their Plants online database and also to an iTree resource code. OpenTreeMap provides a species import template and a python script for importing species. Run manage.py speciesimport <filename>.csv to add species.

Field Choices

OpenTreeMap includes a choices.py file of default values for various select boxes and editable content. Change values in this file before you begin adding tree data.

Geographic Regions (Neighborhoods)

OpenTreeMap allows you to define a collection of geographic regions in a PostGIS table (treemap_neighborhoods). Although the table is named "treemap_neighborhoods" the polygon geometries in this table can be a mixed collection of any type of boundary: cities, townships, municipalities, neighborhoods, etc.

When searching for the region to which a tree belongs, OpenTreeMap scans the region table in order, sorting by the "id" column. This allows you to create a nested hierarchy of regions by adding the geometries with the smallest area to the table before adding geometries with larger areas. For example, lets say the region table that looks something like this:

id name
0 Ogden
1 Salt Lake City
2 Salt Lake County
3 St George
4 Logan
5 Utah

Assume our example tree is in Salt Lake County but not in Salt Lake City. OpenTreeMap will test each geometry in order. The test fails on rows 0 (Ogden) and 1 (Salt Lake City) then passes on row 2 (Salt Lake County). The successful map stops the search. If the tree had not been located within any specific city or county, the last geometry row (Utah, the entire state) acts as a "catch-all."

How to Import Your Geographic Region Data

To get your geographic regions into OpenTreeMap you'll need load the data from each of your shape files (or other geographic data storage) one at a time, in priority order, which usually means from most specific (or smallest area) to least specific (or largest area).

An example for Utah might be:

  1. Load city boundaries (so that OTM will check city boundaries first)
  2. Load county boundaries (next most important, if it doesn't find a matching city)
  3. Load state boundaries

Configuring Geographic Regions as a GeoServer Layer

OpenTreeMap expects that the geographic region table is configured as a layer in the same GeoServer instance being used to generate tree location map tiles. There are two configuration values set in either ''local_settings.py'' or ''impl_settings.py'' which tell OpenTreeMap how to access the geographic region layer through GeoServer.

Setting Details
GEOSERVER_GEO_LAYER The full name of the GeoServer WMS layer (e.g. workspace:layer_name) which configured to render tiles for the geographic region polygons.
GEOSERVER_GEO_STYLE The name of the SLD style definition in GeoServer that should be used to render the region polygons.