Using the Roadkill API to add a Google Map to your webpage

Are you concerned about roadkill? Would you like to display current roadkill information on your website or blog? Now you can using the Roadkills Controller in the Core API. Here's how in three easy steps.

Now, we can add some special parameters to grab the most recent observations. Add to your url the following &start=-730&end=now to limit your results to the last two years of observations. The -730 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.

If you are putting this online you'll need to replace {YOUR GOOGLE MAPS API KEY} with your own where indicated above. If you don't already have one, visit http://code.google.com/apis/loader/signup.html (don't worry they're free!).

The URL you built in Step 1 may be different, edit the following with your url. Keep the final cachebuster part as it'll keep your data current.geoXml = new GGeoXml("http://fishandgame.idaho.gov/ifwis/core/view/roadkills/list.kml?&start=-720&end=now&highway=94817&mpFrom=0&mpTo=22&cachebuster=" + parseInt(Math.random() * 99999999, 10));

Change the zoom center and zoom level by modifying this line appropriately:map.setCenter(new GLatLng(43.58, -116.06), 12);

You may not have full access to HTML behind your pages (for example in a blog). Simply add the <div> section and then past the <script> sections afterwards. If you already have jquery or google maps loaded you may skip these sections.

What is this?

We use the IFWIS Blog to keep our staff, cooperators and the public updated on what we are working on, what's new and share tips about using our software and website.

The content of the IFWIS Blog is often highly technical, but we try our best to keep our posts accessible and jargon-free. When this is not possible, we'll link to other resources online to provide background. Thanks for reading and please follow our blog for updates.