Thursday, March 31, 2011

Displaying GIS Hub Elevation Data in ArcMap – Working with Web Coverage Services

You may have come across some of the Digital Elevation Model (DEM) and shaded relief data that are available from the GIS Hub (or other sites) via web services. If so, perhaps you’ve wondered how you should go about displaying that data and/or using it within ArcMap. If you have wondered about this, then hopefully this little article will be of some assistance.

There are three formats that these data are available in: Web Map Service (WMS), Esri format, and Web Coverage Service (WCS). The data served out via WMS are generally for display only and are generally best used by non-Esri desktop software or web-based applications. One cannot change the display characteristics of a WMS service other than which layers are on or off.

The Esri format is the most likely format you’ll encounter because that is what you first see once you’ve established an ArcGIS Desktop connection to the GIS Hub. For example, once you’ve used ArcMap to connect to the GIS Hub using the Server URL of “http://ndgishub.nd.gov/arcgis/services”, you will see many different services and some folders. If you click on the All_Elevation item and then click the Add button, you are using the Esri format. The problem with the Esri format is that like the WMS data it is display-only, you cannot change its symbology. It will remain in shades of gray.
However, you can use the Identify button in ArcMap and click on the data to find out its elevation. This is the situation at ArcGIS Server/ArcGIS Desktop at 9.3.1. Perhaps things are different at version 10 or perhaps I have set up something incorrectly. If you are getting different behavior than what I’m describing, or know something that I don’t which is very possible, please let me know, but I digress.
WCS is similar to WMS in that non-Esri desktop software can consume these data in this format. However, ArcMap does a great job of using WCS data – you can query the data values with the Identify button and you CAN set the symbology for display. For example, instead of the gray scale image you can define the color range.
To show that using WCS data in ArcMap is relatively easy we’ll go through an example. Begin by going out to the GIS Hub REST and clicking on the All_Elevation item. See, this is easy stuff. Scroll down to the Supported Interfaces section near the bottom of the page then click on the WCS link in that section. This will bring up an ugly-looking page but if you’ve been with me so far I don’t think this will deter you. You’ll see a number of lines containing “xlink:href” followed by a URL (click on the image to expand it):


Copy only the URL within but not including the quotes and then fire up ArcMap. In ArcMap click on the Add Data button then navigate to the top of the menu items until you see the GIS Servers item:


Double-click the GIS Servers item then double-click the Add WCS Server item. Into the URL field paste the URL that you copied from the GIS Hub REST page, then click the Get Coverages button. At this point you will see something like this:


Click OK, making a mental note of the contents of the Name field (so that you can go back to this later), then click the Add button. You will now see a list of all layers in the service:


Click on the “DEM NED 30meter” and the “Shaded Relief NED 30meter” layers to add them to ArcMap. But they are displayed in gray scale but we want to use color! Not to worry! If you don’t know the DEM and Shaded Relief grid values, use the Identify tool to determine the approximate range of elevation values. If you do this, it’s highly recommended that you first zoom in to selected areas before doing the Identify on the DEM and Shaded Relief as the results come back much faster and you may avoid an ArcMap crash.

Go to the properties of the DEM and select the Symbology tab. For Stretch type select “Minimum-Maximum” then place a check mark in the box on the Edit High/Low Values line. Now provide minimum and maximum values and click the Apply button. The dialog should look similar to:


You should now be able to see discernable features in the DEM, though it will still be gray scale:


Do the same thing for the Shaded Relief, setting the minimum and maximum values based on the results from using the Identify tool on the Shaded Relief. Values of 0-350 might be a good starting point in this example.

Time to display the DEM in color! Within the Symbology tab, select a Color Ramp item. You may find it useful to show the names instead of the graphic view. Right-click on the Color Ramp field and then remove the check mark in front of Graphic View, then scroll down and select Elevation #1 or Elevation #2. Click on the Display tab and set the transparency value to something like 40 percent, then click the OK button. In the table of contents, be sure that the DEM layer is above the Shaded Relief layer. When finished, you should now see something like this:


If you would like more information on the finding and using of the GIS Hub web services please visit our Web Services page.



Wednesday, March 9, 2011

Flood Fighting Resource: Using Drupal to Manage Web Site Edits

Beginning in 2010, the North Dakota GIS Technical Committee (GISTC) used the open source content management system Drupal to create and maintain links and pages referring to flood-related data and other resources.  There were and still are, many web-based flood-related references that need to be organized somewhat and to be maintained. Pushing all of these edits through one person (yours truly) who in turn submits an internal work request to make the changes to the GIS web site adds extra time and substantial cost. Drupal allows the GISTC to make our own changes as we need.

GISTC contributors log on to the Drupal-based site using their standard credentials.  These folks can then create, edit, or delete links, pages, or updates. The site has been set up to include an RSS feed, allowing subscribers to be notified of the new or changed information as it becomes available. As of this writing, the GIS web site is a standard web site, not based on Drupal.  However, during flood season the home page of the site is modified to include an area where updates from the Drupal site are automatically displayed.

So why am I telling you this?  One reason is to give you a better idea on how the GISTC works together in the background to create content and useful information. Another reason is to give you an idea on how perhaps your organization could also utilize a tool such as Drupal to quickly create and manage web-based content among a number of editors. 

Thursday, March 3, 2011

Creating a Simple Map using Google and the GIS Hub

There may be situations where it would be handy to drop in a simple map within an existing static web site. This map can contain a base map and one or more layers from the GIS Hub (or other ArcGIS Server resource).

I’m not a developer so I copied and pasted sample code from Esri’s site into a file ending in .html that I created with a text editor. Then I doctored it up so that I could use GIS Hub data and have it zoom to the great State of North Dakota:




I made some modifications to the code that I copied:

  • var centerat = new GLatLng(47.5, -100.5); -- this is used to center the view on the map
  • var initialExtent = new GLatLngBounds(GLatLng(45, -104),GLatLng(49,-96.5)); -- this is used set the extents of the map, note that the zoom window is minimum lat/long followed by maximum lat/long
  • gmap.setCenter(centerat, 7); -- sets the initial zoom scale of the map
  • imageParams.layerIds = [LAYERIDHERE]; -- place one or more layer IDs in place of LAYERIDHERE (see below for more info)
  • ("URLHERE",imageParams, 0.75, dynmapcallback); -- place the URL of the service here in place of URLHERE (see below for more info), .75 is the transparency value
  • "width: 750px; height:450px;" -- the width and height values set the size of the map to be displayed
Not too scary is it? If it is, we’ll catch you at the next posting. If not, and you want to try editing your .html file to display a layer or two from the GIS Hub, then copy and paste the code from the Esri site then modify it so that it looks like the above. The next step is to figure out which URL and layer ID(s) you should be using.

Begin by going to the GIS Hub REST. Let’s say you’d like to display state-managed lands on the map. In the REST, click on the “All_GovtLands_State” item. After doing this, copy the URL displayed at the top of your browser and paste that URL into your .html file, replacing the URLHERE so that the line looks something like this:

("http://ndgishub.nd.gov/ArcGIS/rest/services/All_GovtLands_State/MapServer",imageParams, 0.75, dynmapcallback);

Now add the layer or layers to be displayed. Let’s display Surface Trust Lands and Wildlife Management Areas. Note in the All_GovtLands_State that there are four layers. The Surface Trust Land layer is #2 and the Wildlife Management Areas layer is #3. Edit your .html changing LAYERIDHERE to 2,3 so that line now looks something like:

imageParams.layerIds = [2,3];

Finally, save your work and give it a try by simply double-clicking on the .html file that you have just created. The map should show up in your web browser. After zooming in you should see both the Surface Trust Lands (light blue) and the Wildlife Management Areas (red). For example: