Difference between revisions of "EWX"
Line 76: | Line 76: | ||
Copy the shape files and a raster file to your ArcMap workspace: | Copy the shape files and a raster file to your ArcMap workspace: | ||
− | :copy C:\EWX\data\GAUL\Africa\ | + | :copy C:\EWX\data\GAUL\Africa\g_2008_1.* C:\Users\marty\Documents\ArcGIS\CHIRPS_EAC |
:copy C:\EWX\data\CHIRP_EAC\monthly\data.1982.01.tiff | :copy C:\EWX\data\CHIRP_EAC\monthly\data.1982.01.tiff | ||
In ArcMap add one of the dataset's raster files and the cooresponding vector shape file. | In ArcMap add one of the dataset's raster files and the cooresponding vector shape file. | ||
− | :File>Add Data, CHIRPS_EAC\ | + | :File>Add Data, CHIRPS_EAC\g_2008_1.shp |
:File>Add Data, CHIRPS_EAC\data.1982.01.tiff | :File>Add Data, CHIRPS_EAC\data.1982.01.tiff | ||
Line 89: | Line 89: | ||
::FEW_ID | ::FEW_ID | ||
:Output Raster Dataset | :Output Raster Dataset | ||
− | ::C:\EWX\data\GAUL\Global\ | + | ::C:\EWX\data\GAUL\Global\chirpseac_g2008_1_int.tif |
::Note: Add _int to the name as this is the default data type. You can copy out as a float later. | ::Note: Add _int to the name as this is the default data type. You can copy out as a float later. | ||
:Cell assisgnment type | :Cell assisgnment type | ||
Line 118: | Line 118: | ||
Open ArcToolbox/Data Management Tools/Raster/Raster Dataset/Copy Raster. | Open ArcToolbox/Data Management Tools/Raster/Raster Dataset/Copy Raster. | ||
:Input Raster | :Input Raster | ||
− | :: | + | ::chirpseac_g2008_1 |
:Output Raster Dataset | :Output Raster Dataset | ||
− | ::C:\EWX\data\GAUL\Global\ | + | ::C:\EWX\data\GAUL\Global\chirpseac_g2008_1.tif |
:Pixel Type | :Pixel Type | ||
::32_BIT_FLOAT | ::32_BIT_FLOAT |
Revision as of 13:40, 28 May 2014
Contents
Adding a data layer to the EWX GeoServer
1
Put GeoTiff files in C:\EWX\data\xxx
2
Add, or copy and paste, a <dataset> tag in the C:\EWX\geoserver-2.1.1\data_dir\updater\datasets.xml file for the new dataset.
- Note: it is convenient to use the Programmer's Notepad with this file and control-click the first <datasets> tag closed and then click it open (without the control key) to open it back up with all other tags closed.
3
Set the variables in the dataset tag:
- reloadAll: "true" or "false" depending if you want to reload the workspace and recalculate all the statistics.
- id: This is used as a referenced used with the window tag id attribute. See <window> tag below. This is also used as a prepend for the database spatial statistics table name.
- Important This name can not contain the special characters "_" or "-".
- directoryPath: The location of the data files.
- name: The name used in the dataset listing in the left column of EWX.
- shortName: Not sure where this is used for.
- dataType: "RASTER" or "VECTOR"
- fileType: "GeoTIFF" or "Shapefile"
- workspace: Name of the workspace folder in C:\EWX\geoserver-2.1.1\data_dir\workspaces that will be created.
- This name also defines the start of the name of the GeoTIFF file that is used to calculate geo-statistics.
- Important This name can not contain the special characters "_" or "-". EWX will truncate the name at the first special character and use that to find the GeoTIFF file for spatial statistics.
- This word also is used to define the start of the database table.
- fileNameSuffix: "tiff" or "tif"
- showInTree: "true" or "false" to show dataset in left column of EWX. Default is true.
4
If this is a new region, add a <region> tag in datasets.xml Copy and past from existing region tag and change id, name and coordinates.
- id: attribute to be referenced in window tag
- name: label to use in EWX left hand pane
- gridBounds: defines the min_lon, min_lat, max_lon, max_lat, respectively.
- <region id="whem" name="Western Hemisphere">
- <gridBounds>
- <coords>
- <double>-130.0</double>
- <double>-50.0</double>
- <double>-30.0</double>
- <double>50.0</double>
- </coords>
- <coords>
- </gridBounds>
- <gridBounds>
- </region>
5
Add a <window> tag for the new dataset
- id: This attribute should be a combination of the region and dataset-ref attributes (see below) separated by a hyphen.
- region: The region id tag to group this window under in EWX in the left hand pane.
- dataset-ref: A reference to the dataset tag's id attribute to use.
- label: The label to use in the EWX left hand pane.
- related-layers: tag defining layers to display in and EWX data window "fly-out pane" activated by map's upper left corner "layers" icon.
- <window id="global-chirpsclim" region-ref="global" dataset-ref="chirpsclim" label="CHIRPSclim">
- <related-layers>
- <related-layer dataset-ref="global_g2008" file-ref="global_g2008_0" name="Countries" initially-visible="true" />
- <related-layers>
- <window id="global-chirpsclim" region-ref="global" dataset-ref="chirpsclim" label="CHIRPSclim">
6a
Add a tif file and associated files to the GAUL data directory. C:\EWX\data\GAUL Associate files are: tfw, tif.aux.xml, tif.vat.dbf, xml files.
If this data layer has the same resolution, boundaries and target (cropzones, g2008_0, admin0) as another data layer, then the files can be copied and renamed for the new data layer. The new name is a combination of the dataset id, region and shapefile defining the sub-regions.
cp chirps_global_cropzones.tfw chirpsclim_global_cropzones.tfw cp chirps_global_cropzones.tif chirpsclim_global_cropzones.tif cp chirps_global_cropzones.tif.aux.xml chirpsclim_global_cropzones.tif.aux.xml cp chirps_global_cropzones.tif.vat.dbf chirpsclim_global_cropzones.tif.vat.dbf cp chirps_global_cropzones.tif.xml chirpsclim_global_cropzones.tif.xml
6b Build TIFF for statistics in ArcMap
If the previous method can not be employed then this is the proceedure to follow... good luck!
Copy the shape files and a raster file to your ArcMap workspace:
- copy C:\EWX\data\GAUL\Africa\g_2008_1.* C:\Users\marty\Documents\ArcGIS\CHIRPS_EAC
- copy C:\EWX\data\CHIRP_EAC\monthly\data.1982.01.tiff
In ArcMap add one of the dataset's raster files and the cooresponding vector shape file.
- File>Add Data, CHIRPS_EAC\g_2008_1.shp
- File>Add Data, CHIRPS_EAC\data.1982.01.tiff
Open ArcToolbox/Toolboxes/System toolboxes/Conversion Tools/ToRaster/Feature to Raster
- Input Features
- g2008_0
- Value field
- FEW_ID
- Output Raster Dataset
- C:\EWX\data\GAUL\Global\chirpseac_g2008_1_int.tif
- Note: Add _int to the name as this is the default data type. You can copy out as a float later.
- Cell assisgnment type
- CELL_CENTER
- Priority field
- NONE
- Cellsize
- 0.050000001, note: this should be autofilled when you select the file in Environments/Processing Extent (see below) but it isn't.
- It is when you select Feature to Raster so a workaround is to open that and copy the numbers.
Open Environments.../
- Output Coordinate System
- Same as layer "data.1982.01.tiff"
- Processing Extent and chose raster file.
- Extent
- Same as layer data.1982.01.tiff
- Snap Raster
- data.1982.01.tiff
- Extent
- Raster Storage
- unselect Build pyramids
- unselect Calculate Statistics
- Compression
- NONE
This should be enough but the tif is not parsible by EWX so it hast to be copied out as a 32 bit float image. Open ArcToolbox/Data Management Tools/Raster/Raster Dataset/Copy Raster.
- Input Raster
- chirpseac_g2008_1
- Output Raster Dataset
- C:\EWX\data\GAUL\Global\chirpseac_g2008_1.tif
- Pixel Type
- 32_BIT_FLOAT
Then remove the integer tif and replace and copy tif files to GAUL directory.
7
Run the datasets.xml file throught an online xml validator ([1]) to be sure you didn't mess something up.
8
Make sure the GeoWebCache directory is cleared for the dataset before restarting. There may be some cruft in there from previous attempts.
- C:\EWX\geoserver-2.1.1\data_dir\gwc
Adding a "style" to the EWX GeoServer
Styles modify the maps being displayed by the EWX server. The GeoServer v.2.1.1, which actually serves the maps, uses the Styled Layer Descriptor (SLD) markup language to do this. An intro to SLD can be found at:
http://docs.geoserver.org/2.1.1/user/styling/sld-introduction.html
The styles are locate is this directory:
C:\EWX\geoserver-2.1.1\data_dir\styles
They consist of a .sld and a .xml file. The xml file is generated by the GeoServer upon submission of the sld file. A new SLD style file has to be submitted through the GeoServer admin interface located at:
http://chg2.geog.ucsb.edu:8080/geoserver/web
Log in as admin after you have received the password from Marty. Then click the "styles" link in the left hand pane and then click on "Add a new style". You can then copy and paste your SLD content into the editing window and use the "Validate" button to validate the markup code. You have to click the "Submit" button for the GeoServer to create the xml and sld files in the styles directory. You can then use the name you entered in the "Name" box in the datasets.xml file to connect a dataset to the new style. The datasets.xml file is located at:
C:\EWX\geoserver-2.1.1\data_dir\updater
The name is entered as the style attribute to the statistic tag of the dataset tag.
If the style is being applied an existing dataset:
- set the dataset reloadAll tag to true
- remove the datasets workspace located at: C:\EWX\geoserver-2.1.1\data_dir\workspaces\…
- stop and restart EWX in a cygwin terminal window on CHG2 with the following commands:
- cd /cygdrive/c/EWX/apache-tomcat-6.0.33/bin
- ./catalina.bat stop
- cd /cygdrive/c/EWX/apache-tomcat-6.0.33/bin
- ./catalina.bat start
Tips
Use the GeoServer admin interface to edit and modify your SLD file as it will color code your markup and you can submit and apply the modified version in the interface. You can then examine the results by going to and EWX window (http://chg2.geog.ucsb.edu:8080/EWX/index.html) and opening the dataset. If you are iterating through multiple changes, you will need to either remove the GeoWebCache files at:
C:\EWX\geoserver-2.1.1\data_dir\gwc
or avoid viewing the same dataset and time period by progressing through the time series without selecting previously cached dates.
You can look for errors in the EWX log console (it appears when you start EWX) up or look in the log files at:
C:\EWX\apache-tomcat-6.0.33\logs\catalina.yyyy-mm-dd.log