Search This Blog

Friday, June 15, 2012

Using One Shapefile to display Multiple Map Layers in ERMA

I thought I was late to the party learning how to utilize one shapefile as the basis for multiple map layers simultaneously in ERMA.  However, I soon discovered that most seasoned ERMA uploaders either didn’t know this workflow or were under the impression that this creates a database conflict in ERMA (it doesn’t).  Hence, a blog post!

Case study: I received model outputs that contain environmental data for a large number of grid cells over a study area.  For each grid cell in the attribute table, data are provided for every month over a period of 7 years (Figure 1).  My goal was to create layers in ERMA that show the environmental data by month and year.  This shapefile is around 30 megabytes, so duplicating it and uploading it to ERMA multiple times in order to have a shapefile for each layer to point to would have occupied a lot of space both on my computer and in the ERMA database.


Figure 1.  Master shapefile containing data for multiple months/years to be uploaded.


Instead, you can upload the master shapefile once, and set up multiple layers in ERMA for months/years of interest.  Each map layer will have symbology that references a different column in the same shapefile’s attribute table.

The workflow: do any processing and have the master shapefile zipped and ready to upload.  Run through a typical upload, and create your first layer for a month/year of interest, and set up the symbology to display as you’d like it to (Figure 2).
 
Figure 2.  One layer’s symbology for a particular month/year.
 
 
Once you have one layer set up, the workflow changes for the remaining layers.  Now, go to the Admin menu in ERMA and select “Map Layers” in the drop-down list.  Search the list and locate the first layer you created (I used the “F” button to filter for map layers containing a keyword specific to my dataset) (Figure 3).

Figure 3.  Search for and locate your first map layer.
Once you’ve found it, scroll all the way to the right in the Map Layer list and click “copy” (Figure 4).

Figure 4.  Scroll to the right, and click copy, to make a copy of your first map layer.
 Once you’ve clicked “copy” the following screen will appear (Figure 5).  Give your new layer a name that is different from the original map layer.  In my case, it made sense to name layers with the month/year of interest in the title.  Also write a description for the new layer, to be displayed in the table of contents.  Next, notice that ERMA tells you what the original shapefile was, and gives you a pull-down box to locate a shapefile for your new layer.  Simply find the same original shapefile in the pull-down list.  Then click “copy map layer.”

Figure 5.  The copy map layer window in ERMA, with the fields you need to populate outlined.     
 
Once you click “copy map layer,” ERMA will tell you what field was originally used to categorize data, and ask you to select a class item for the new layer (Figure 6).  I selected a different month/year.  Then click “copy map layer” again.

Figure 6.  Select a class item to symbolize the new layer.  In my case, this meant choosing a different month/year.

ERMA will then show you a window saying “Copy successful.  Click here to edit.” Click on the link to finish editing your layer (Figure 7).




Figure 7.  Next screen you’ll see in ERMA.  Click on the “here” link.

If you click on the link, the typical edit map file layer that you use to modify symbology appears.  Choose a mapfile from the drop-down list for your new layer to go into (Figure 8).  For example, my designated mapfile is 855 so I use that.  Note: putting the new layer in a mapfile is a critical step – otherwise you will not see the layer in the map layer list when you try to add it to the TOC later.  Make whatever changes need to be made to your new layer for the symbology to reference the correct column in the shapefile’s attribute table (Figure 8).  In my case, this meant editing all of the mapserver expressions to a different month/year corresponding to an attribute table column.  When you’re done editing the symbology, click generate, and save and continue.


Figure 8.  Assign your new layer to a mapfile, and edit the symbology as needed.


Now, switch gears and close out of any editing windows you have open.  Navigate to the location in the Table of Contents where you intend for your new layer to appear.  Highlight the parent folder, check the manage box, and then click “new layer.”  Give the new layer a description, and select “wms internal” from the pull-down list (Figure 9).  Fill out any other information as needed – permissions, metadata lite, etc.  Then, toward the bottom of the window, select the mapfile you created using the first part of this workflow from the drop-down list.  When you’re done setting up your layer, click “save.” 


Figure 9.  Set up your new layer as a WMS internal, and select it in the drop-down map file list.


You’re done!  Repeat this workflow, minus the initial shapefile upload, repeatedly until you’ve created all the layers you need.


No comments:

Post a Comment