idfg-bthomas's blog

Highway 21 Wildlife Underpass is Working (with Photos)

As the scenic State Highway 21 snakes its way across the Boise Mountains, it also intersects another favorite travel route.

For millennia, mule deer and elk have traveled to and from low elevation ranges where they spend the winter, to mountain meadows where they grow fat each summer feasting on the rich vegetation found at higher elevations. In doing so, they must cross State Highway 21.

In recent years, from 75 to 200 or more mule deer and elk, crossing the highway between Boise and Robie Creek, have been killed by vehicles each year.

So far this spring, only one animal has died in the stretch with a recently completed wildlife underpass.

The underpass was completed in October on Highway 21 near milepost 18.2, at the site of a well-documented big game migration "funnel" and subsequent collision "hotspot." A bridge replaced the fill that had supported the road, opening this migratory corridor to deer and elk. By physically separating wildlife and motorists, the underpass now provides protection for both.

The second phase of this project involves building a wildlife fence on the east side of the road to direct deer and elk away from the highway and towards the underpass.

Federal stimulus money was used to build the bridge and part of the fence. But additional funding is still needed to complete the fencing project.

A group of local people working together to find ways to reduce wildlife-vehicle collisions on our roads and highways worked with the Idaho Transportation Department to get the underpass built. The group's focus now is raising the money to complete the wildlife exclusion fencing to make the underpass even more effective than it has already been shown to be.

Dubbed the Boise River Wildlife Linkage Partnership, the group includes private citizens, business people, non-profits and city, county, state and federal representatives.

Underpass Photos (click for full-size):

Photo Photo Photo Photo Photo Photo Photo Photo

Story cross-posted from IDFG Press Release, Highway 21 Wildlife Underpass is Working
Photos courtesy of Idaho Transportation Department

Adding X,Y Centroids to Polygons in ArcGIS ArcView

Creating a centroid point file from a polygon in ArcEditor or ArcInfo is quick and painless.  In ArcToolBox go to Data Management Tools/Features/Feature to Point and follow instructions.

There is a downside to this convenience however.  8,910 dollars of them in fact, the cost of an ArcInfo license.

How to calculate centroids in ArcView.

  1. In the attribute table of your polygon layer and under Options choose Add Field.
    Add Field

     

  2. Add an X and Y field of type Double
    Add Field Dialog
  3. Right-click on the New X Column Header and choose Field Calculator.

     
  4. In the Field Calculator Dialog that opens, click Help

    Here's all the instructions you need, but they are written in ESRI.  Allow me to translate.  Copy this section:
      Dim Output As Double
      Dim pArea As IArea
      Set pArea = [Shape]
      Output = pArea.Centroid.X

    Paste it into Field Calculator.  Check Advanced, and enter Output into the final textbox.

    Like this:
    Field Calculator

     

  5. Click OK and repeat for Y.

You now have the X,Y coordinates of the polygon centroids.  If you really need a separate point layer, copy the DBF file for your polygon layer to a new file and add as a point layer using the Add X,Y Data... dialog under the Tools menu.

Exporting, Downloading and Linking to Roadkill Reports

The Export Roadkill Data feature allows you to download or live link to roadkill reports in a variety of format and subsets.

By default, the page will show the 50 most recent roadkill reports statewide.  You can paginate through the reports by using the next, previous, and last links at the top and bottom of the table.  Click details at the start of any individual row to see all the information publicly available (contact details are omitted from public views), a map, and associated files and photos if they have been approved for web publication.

HTML is not the format you are looking for?

You'll notice that there are four icons immediately above the table.  These formats allow you to break the information you are viewing out of the webpage.

CSVCSV - Opens in Microsoft Excel and other Spreadsheet software.  It also easily imports into various databases

KMLKML - Opens in Google Earth, ArcGIS and imports into many GPS Units.  You may download this file for remote viewing, or link to it live to see new roadkills on a map as they are entered.

JSONJSON - Is a format that allows script remote computers to link live to data streams on detached computers.  This format enables robust web "mashups" of roadkill reports.

RSSRSS - Is a syndication format which allows you to keep track of the most recent updates.  You may consume RSS through a news reader, Microsoft Outlook or use third-party services like Feedburner (to get receive daily email digests) or Google Feeds (to embed recent roadkill on your blog or webpage)

 

Are you only interested in part of this?

Use the filter features to subset the dataset by species, observation date, highway, milepost range, report date.  You may also change how many records are retrieved.  At this time, 1000 records is the maximum download, but we'll be working on caching features soon to enable complete downloads.  All filters are optional.  All formats are available.

Slice, dice, download, embed and link to your heart's content.

Roadkill is our first public demonstration of the new IFWIS Core API that will soon be powering more of our IFWIS Applications. 

We want to make data, open, accessible and easy to use.  Please let us know what works, what doesn't and how we can make this better.

GeoTagged Photos Simplify Roadkill Reporting

We've tried to make reporting roadkill as simple as possible, but even still, it took five steps to outline in our post How to Report Roadkill.  Until now.

When 5 Steps is Two Steps Too Many.

Reporting Roadkills with your Photos.

We've just finished a new feature in our Roadkill Reporting, Photo Upload.  The best part isn't even all the pretty pictures of schmeared and desiccated wildlife that met an unfortunate fate attempting to cross our roadways. 

The best part is that if you have a camera phone or GPS-enabled device your photos will automatically record the location and datetime of the observation. 

Combine this with your contact information auto-filling when your logged in and you're down to  entering the Observed Species and pressing Save.  Yes, it's that easy.

Roadkill GeoTagged Photo Report in 3 Steps

To get started visit https://fishandgame.idaho.gov/ifwis/roadkill

1.) Upload Your File

In the right-hand sidebar click Upload File and select the photo to upload.

In modern web browsers (Chrome, Firefox, Opera, Safari or IE9+) you may drag and drop your photos to upload.
Drag and Drop your Photo

After the photo has uploaded you will see a summary of the information extracted from the image.  This may include both the date and location.

If you are already logged in and you are the observer, you may now skip ahead to species details.

2.) What

Enter the Observed Species Details
Start typing a scientific or common name and select from the dropdown list.  For the selected species answer the short list of questions as best as you are able.

Here is an example for the observed elk we uploaded in Step 1.

The location section will already be completed from your photo, so you may enter a precision (likely with 10 meters if using GPS) and you are done!

3.) Press Save Wildlife Collision to submit your Roadkill Observation.

 

We were able to skip a quite a few steps using our geotagged photo.  For complete instructions detailing every question on the form, view our post How to Report Roadkill.

How to Report Roadkill

Would you like to share roadkills you witness?  It's quick and easy and helps Idaho Fish and Game (IDFG) and the Idaho Department of Transportation (ITD) work to avoid future wildlife collisions.

Reporting Roadkill is Quick and Easy

How to Submit a Wildlife Collision in 5 Steps...

To get started visit https://fishandgame.idaho.gov/ifwis/roadkill

1.) Who

Enter a few details about yourself, the Observer.
Don't worry we won't share this, but we do need to contact you if we have questions.

We admit that entering all this information is quite a pain if you'll be reporting often.  That's why we encourage you to create an account.

Once you have created an account your contact information will auto-fill.  You'll also be able report for friends and family members with a single click.  In fact, all your commonly used settings will be stored in quick-access shortcuts.
 

2.) When

Enter the date of the observation and an accuracy
You may type a date, or pick a date from the calendar.  Choose from the list an accuracy for the selected date.

Optionally, you may enter any more details you may have about the time of the observation (e.g. "Observed at Time Zone Rapid in Riggins and I'm not sure if this observation was at 2:05PM or 3:05PM").

3.) What

Identify the species
Start typing a common name (e.g. Moose) or scientific name (e.g. Alces americanus) and pick a species from the dropdown list that appears.

Add some Detail
How many? How old? What gender? Was it still alive? Other details?

4.) Where

Provide a location of the roadkill
Use one of four options to provide a location:

  • Click on the map  (You can pan, zoom and click again to move the marker)
  • Pick a Highway and Mile Marker  (US 93, Milepost 486)
  • Type an Address or Intersection  (600 S. Walnut St. Boise)
  • Provide an X & Y Coordinate   (43.5,-114.72 or 43 30,114 43.2 or N43 30,W114 43 12)

Add a Confidence Level for your location and optionally any Additional Location Information and you're done!

5.) Click Save Wildlife Collision to submit your observation!

The full details of your observation will appear upon submission.

You may review and download your previous submissions in the sidebar.  For larger exports in a variety of formats from csv to xml use the Export Roadkill Data tool.
 

Improved PDF Maps on the HuntPlanner

We're happy to announce that we've added new improved PDF Maps to the Huntplanner!  The maps have been redesigned to be easier to read and use in the field. 

Highlights:

  • Hunt and National Forest boundaries clearly marked
  • Prominent physical features and towns noted
  • Improved streams symbols and shaded relief to assist with navigation.
  • Public and private land management are clearly defined
  • Customized rendering for improved readability and various scales
  • Designed for regular and colorblind hunters

You can view and download the new maps on details page for each hunt or directly from the map index.

Here's a preview of the new design.  Thanks for all the hard work Angie!

Changing the Owner of Tables in SQL Server

You may configure SQL Server such that users who are not dbo may create tables, but you set yourself up for a world of pain.

Soon, you can no longer do simple table selects (because dbo is inferred) and instead must resort to prefacing every join with [user].[tablename].[fieldname].

The solution is a SQL Server system stored procedure sp_changeobjectowner:

EXEC sp_changeobjectowner 'user.table', 'dbo'

Note that this operation will clear all privileges.

Credit goes to my old co-worker Bruce, who shared this solution many six years ago in an email titled, "Lucky You". I had several hundred tables and views to re-title and privilege at the time.

Using the Google Maps API v.3 and the Roadkill API to add a Real-Time Map to your webpage or blog

NOTE: This is an update to an earlier demonstration post using the Google Maps API v.2 to add recent roadkill information to your webpage or blog.

STEP 1. Configure the URL to request

Visit http://fishandgame.idaho.gov/ifwis/core/view/roadkills and design your query using the editor.  For example, you may just be interested in one Highway section such as the first 22 miles of Highway 21.

Stripped of the empty parameters your url should now resemble: http://fishandgame.idaho.gov/ifwis/core/view/roadkills?highway=94817&mpTo=22

Now, we can add some special parameters to grab the most recent observations.  Add to your url the following &start=-365&end=now to limit your results to the last year of observations.  The -365 is the number of days before the current date and time to include.  You may tailor this to your needs.  You can of course also use full dates, but this allows your query to be dynamic and useful in the future.

Possible parameters for date fields Observed Date (start, end) and Reported or iNsert Date (nstart, nend) include:

  • Valid dates in the format 1/10/2008
  • Now - current system datetime in Mountain Standard Time
  • Today - current day in Mountain Standard Time
  • Yesterday - previous day in Mountain Standard Time
  • Integer - positive or negative offset in days

Finally, add the kml extension, by copying the path from the kml icon or copying the following:

http://fishandgame.idaho.gov/ifwis/core/view/roadkills/list.kml?highway=94817&mpTo=22&start=-365&end=now

 

STEP 2: Add the Code

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>IFWIS Roadkill API Google Maps JavaScript API v3 Example</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function initializeMap() {
  var mapCenter = new google.maps.LatLng(43.58, -116.06);
  var myOptions = {
    zoom: 12,
    center: mapCenter,
    mapTypeId: google.maps.MapTypeId.TERRAIN
  }
  var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
  var ctaLayer = new google.maps.KmlLayer('https://fishandgame.idaho.gov/ifwis/core/view/roadkills/list.kml?highway=94817&mpTo=22&start=-365&end=now', {preserveViewport: true});
  ctaLayer.setMap(map);
}
</script>
</head>
<body onload="initializeMap()">
  <div id="map_canvas">Map Loading...</div>
</body>
</html>

 

STEP 3: Enjoy

Here's a Live Example

Loading...

What you see here is a live example of the same code from Step 2 above except instead of using the onload event of the html body, the scripts are placed immediately following the div element inside the html body.  Using this method you may place live maps on blogs, forums and other websites.

Explore the Google Maps Javascript v3 API and IFWIS Core API for more mashup ideas!

Using the Google Visualization API, Basic Pie Image Charts

As we move away from server-side generation of graphics, many people have been inquiring as to how to use Google Charts, Graphs and Maps in their applications.  In this series I'll start with the simplest integration and slowly add complexity to see what is possible.

There is lots of great documentation on Google's site and in various blogs, so please don't use this as your sole reference, only as a starting point to get an idea of what is possible.

Starting Basic

Let's say you have a simple dataset like the following and you just want to add a pie chart your users can download and use in their presentations.

Species Count
Bridgelip Sucker 1
Brook Trout X Bull Trout 23
Bull Trout 2
Chinook Salmon 365
Mountain Whitefish 15
Sculpin (Var. Species) 0
Steelhead (Snake River Basin) 118
Westslope Cutthroat Trout 3

While there are lots of fancy tools available in the Google Charts API, but making a pie chart with a small dataset like this can be as simple a calling their API and getting an image returned inside an <img> tag.

Let's look at the basic image URI structure from the Chart API Documentation:

http://chart.apis.google.com/chart?chs={width}x{height}&cht={charttype}&chd=t:{comma-delimited values}&chdl={pipe-delimited legend}

Adding our data we get:

http://chart.apis.google.com/chart?chs=500x250&cht=p&chd=t:1,23,2,
365,15,0,118,3&chdl=Bridgelip+Sucker|Brook+Trout+X+Bull+Trout|
Bull+Trout|Chinook+Salmon|Mountain+Whitefish|Sculpin+%28Var.+
Species%29|Steelhead+%28Snake+River+Basin%29|Westslope+
Cutthroat+Trout

If you're a Windows Developer, at this point you may be wondering how you get your data to display with all these funky pluses and %29 characters.  The answer for .Net is server.urlencode(string).

To build the string above I'd loop through the data once and create two strings, one pipe-delimited, one comma-delimited.  Outside the loop I'd concatenate them all into one string and finally urlencode:

string labels = "";
string vals = "";
foreach (specieslistitem a in specieslist)
{
    labels += a.Species +  "|";
    vals += a.Count + ",";
}
string uri = "http://chart.apis.google.com/chart?chs=500x250&cht=p&chd=t:" + server.urlencode(vals.substring(0,vals.length-1)) + "&chdl=" + server.urlencode(labels.substring(0,labels.length-1));

We can then create an image tag that looks like this to display the chart:

<img src="http://chart.apis.google.com/chart?chs=500x250&amp;cht=p&
amp;chd=t:1,23,2,365,15,0,118,3&amp;chdl=Bridgelip+Sucker|
Brook+Trout+X+Bull+Trout|Bull+Trout|Chinook+Salmon|Mountain+Whitefish|
Sculpin+%28Var.+Species%29|Steelhead+%28Snake+
River+Basin%29|Westslope+Cutthroat+Trout"  alt="Pie Chart"/>

Pie Chart

 

That was pretty painless.  Let's see what we can do to make that better.

 

Add Data Labels

We can change that by changing the legend to labels by modifying the "chdl" parameter to "chl":

<img src="http://chart.apis.google.com/chart?chs=500x250&amp;cht=p&
amp;chd=t:1,23,2,365,15,0,118,3&amp;chl=Bridgelip+Sucker|
Brook+Trout+X+Bull+Trout|Bull+Trout|Chinook+Salmon|Mountain+Whitefish|
Sculpin+%28Var.+Species%29|Steelhead+%28Snake+
River+Basin%29|Westslope+Cutthroat+Trout"  alt="Pie Chart"/>

Pie Chart

 

Some Final Tweaks

Now let's add a few fixes to improve legibility.

  • Add a color gradient using the Chart Color parameter (chco): chco=006633,FFFF33.
  • Insert a Chart Title Top parameter (chtt): chtt=Observed+Species+on+Secesh+River
  • Change the Chart Type (cht) to a 3D Pie: cht=p3
  • Modify the Chart Size (chs) to better accomodate the long labels: chs=500x150

Pie Chart

That's better, and a way more Fish and Gamey color scheme.  It could certainly use work, but it's good enough to get the general idea. 

 

In the Next Episode

In the next posts I'll explore a few more chart types and then move beyond building your charts in the URL to creating and using JSON data sources to build charts, add some interactive features to allow users to modify features of the chart and finally illustrate how to expose your JSON data sources as APIs for our collaborators and the public to use and explore.

What would make the Huntplanner better?

The Huntplanner is now eight years old and overdue for an overhaul. Over the next month the IFWIS Team will be rebuilding the site from the ground up and we'd like your input.

How could it be better? What doesn't work? What features would you like to see in the next release? Let us know!