Monday, October 11, 2010

Species distribution maps, distributed

Jon Sullivan describes how web developers can add live NZBRN distribution maps to their webpages.

One of the fantastic things about the New Zealand Biodiversity Recording Network is that it can make distribution maps using Google Maps for all New Zealand species of birds, plants, mammals, fungi, reptiles, frogs, and (soon) invertebrates. The distribution maps are as extensive as the data entered into NZBRN. For common and charismatic species this means we already have thousands of points to map. For example, the following map is a live display of all bellbird observations in NZBRN. You can use this map just as if you were in NZBRN. You can click on the red "Show all markers / group markers" in the map to toggle on and off the clumping of points, zoom in and move about in the map, and click on any point for more information.


Distribution map of bellbirds (Anthornis melanura) in New Zealand.
View Larger Map | Enter your own observations
Source: New Zealand Biodiversity Recording Network.


The usual way to see these maps is to go to the NZBRN website, enter a Portal (for bellbirds, it would be the Birds portal), select your species of interest, push the search button, then select "Google map" from the options for displaying results.

What if you want to take one of these maps and add it to your own website? You can. Indeed, we encourage you to do this. Here is how.

More...

The following HTML code is what made the above bellbird map. If you paste it into your website, it should make the bellbird map.
<iframe width="525" height="800" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://www.nzbrn.org.nz/birds/uttag_google.asp?art=506&art_leaf=False">Oops. Your internet browser does not understand iframes. You can view this map at the <a href="http://www.nzbrn.org.nz/birds/uttag_google.asp?art=506&art_leaf=False">New Zealand Biodiversity Recording Network (NZBRN) website</a>.
</iframe><br /><small>Distribution map of bellbirds (<i>Anthornis melanura</i>) in New Zealand.<br /><a href="http://www.nzbrn.org.nz/birds/uttag_google.asp?art=506&art_leaf=False">View Larger Map</a> | <a href="http://www.nzbrn.org.nz">Enter your own observations</a><br />Source: <a href="http://www.nzbrn.org.nz">New Zealand Biodiversity Recording Network</a>.</small>

What happens if you do not want a bellbird map? You will need to copy the relevant web address (URL) directly from NZBRN for your species of interest. You can get this by right clicking and copying the link for the "Google map" button in the results of any NZBRN search. That is what I was doing in the screenshot below, after searching on "kowhai" in the Plants portal and selecting to display the results for the genus Sophora L. (which includes all kowhai species).


Note that if you instead just click on this map link and load the map, a generic URL is displayed on the loaded webpage that will not work for copying or bookmarking. It's the same generic URL for any loaded map.

Once you've copied this link, you will need to paste it into my bellbird HTML code replacing my three bellbird URL with your own. Then, add that to your webpage and you should be good to go.

If you do this in several portals, you will see that the structure of the URL differs somewhat among portals. For example, the link to the map for kowhai that I got from the "Copy link" in the above screenshot is
which is a little different in structure from the bellbird URL in my first example,
NZBRN uses id numbers to refer to species in its web addresses. The bellbird in the first example is id 506 (and is referred to as "art=506" in the URL). The plant portal uses more elaborate ids for genera and species. In the above example, Sophora L. is id 79EA7DFA-5159-45B0-9221-726B272787C1. The easiest way to deal with this is as I described earlier. Just copy and paste the link for your species of interest from NZBRN.

Other than replacing out the three URL in my demo HTML code with your copied URLs, you can also change the width and height values. The next map displays the distribution of Sophora L. in New Zealand in a smaller space on the page.


Distribution map of kowhai (Sophora species) in New Zealand.
View Larger Map | Enter your own observations
Source: New Zealand Biodiversity Recording Network.


Here is the HTML for that map.
<iframe width="400" height="400" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://www.nzbrn.org.nz/plants/uttag_google.asp?art=79EA7DFA-5159-45B0-9221-726B272787C1&standalone=false">Oops. Your internet browser does not understand iframes. You can view this map at the <a href="http://www.nzbrn.org.nz/plants/uttag_google.asp?art=79EA7DFA-5159-45B0-9221-726B272787C1&standalone=false">New Zealand Biodiversity Recording Network (NZBRN) website</a>.
</iframe><br /><small>Distribution map of kowhai (<i>Sophora</i> species) in New Zealand.<br /><a href="http://www.nzbrn.org.nz/plants/uttag_google.asp?art=79EA7DFA-5159-45B0-9221-726B272787C1&standalone=false">View Larger Map</a> | <a href="http://www.nzbrn.org.nz">Enter your own observations</a><br />Source: <a href="http://www.nzbrn.org.nz">New Zealand Biodiversity Recording Network</a>.</small>

NZBRN's implementation of Google Maps currently lacks some of the available bells and whistles. Most importantly, as you may have noticed in my kowhai example, it is not currently possible to set the zoom level or what part of the map is displayed. This means, for example, that it is not (yet) possible to display a live link to a map of the bellbirds of Canterbury. It also means that when you reduce the height and width values in the HTML code, you end up seeing a smaller and smaller part of the top left corner of the map. The map always is of New Zealand and always starts at the same initial scale. We hope to soon be upgrading the foundations of NZBRN and as part of this we will make this feature more flexible.

No comments:

Post a Comment