Open n8upham opened 4 years ago
@jdhan39 Let's start here -- some ideas for features:
each country in which the species is extant or reintroduced into its native distribution is listed and separated by pipes (|); only the species native distribution or ancient introductions are included, whereas subjectively recently introduced populations in different countries are not included; countries in which the species is uncertainly present or possibly extinct are listed with a question mark (?) following the country; domestic species are listed as "Domesticated"; for fully extinct species, the distribution reflects the species distribution in the last 500 years (although this is somewhat subjective as well); for marine species, the countries in which the species is found along the coastline or in inland rivers are listed; when an 'and' is present within the countries name, it is listed using the ampersand (&); dependencies are listed when geographically distant from there dependent country (see list below for specific examples); there are a number of city states and minor territories that are not included separately since most distributional data does not account for these regions, these include Andorra, Monaco, San Marino, the Vatican, Gibralter, Saint Pierre & Miquelon, and any nearby islands or exclaves that are geographically close to the primary country or territory; the following is a list of the countries, dependencies, and territories listed as well as the spelling used for each: Greenland|Alaska|Canada|United States|Bermuda|Mexico|Guatemala|Belize|El Salvador|Honduras|Nicaragua|Costa Rico|Panama|Bahamas|Cuba|Jamaica|Haiti|Dominican Republic|Cayman Islands|Puerto Rica|United States Virgin Islands|British Virgin Islands|Turks & Caicos|Anguilla|Saint Martin|Saba|Saint Barthélemy|Montserrat|Martinique|Guadeloupe|Sint Eustatius|Saint Vincent & the Grenadines|Saint Kitts & Nevis|Saint Lucia|Grenada|Barbados|Antigua & Barbuda|Dominica|Aruba|Bonaire|Curaçao|Trinidad & Tobago|Colombia|Venezuela|Guyana|Suriname|French Guiana|Ecuador|Galapagos|Peru|Brazil|Bolivia|Chile|Argentina|Falkland Islands|Kerguelen Islands|Prince Edward Islands|South Georgia & the South Sandwich Islands|Saint Helena|Iceland|Norway|Sweden|Finland|Ireland|United Kingdom|Portugal|Spain|France|Belgium|Netherlands|Luxembourg|Germany|Denmark|Switzerland|Liechtenstein|Italy|Malta|Austria|Hungary|Slovakia|Czech Republic|Slovenia|Croatia|Bosnia & Herzegovina|Serbia|Kosovo|Montenegro|Albania|North Macedonia|Greece|Cyprus|Bulgaria|Poland|Moldova|Romania|Belarus|Lithuania|Latvia|Estonia|Russia|Georgia|Armenia|Azerbaijan|Turkey|Syria|Lebanon|Israel|Palestine|Jordan|Saudi Arabia|Qatar|Bahrain|Oman|Yemen|Kuwait|Iraq|Iran|Turkmenistan|Uzbekistan|Kazakhstan|Tajikistan|Kyrgyzstan|Afghanistan|Pakistan|Mongolia|China|India|Nepal|Bhutan|Bangladesh|Sri Lanka|Maldives|North Korea|South Korea|Japan|Taiwan|Vietnam|Laos|Cambodia|Myanmar|Thailand|Malaysia|Singapore|Andaman Islands|Nicobar Islands|Christmas Island|Cocos Islands|Indonesia|Brunei|Philippines|East Timor|Papua New Guinea|Solomon Islands|Australia|New Zealand|Micronesia|Fiji|Kiribati|Marshall Islands|Nauru|Palau|Samoa|Tonga|Tuvalu|Vanuatu|Cook Islands|Niue|American Samoa|Easter Island|French Polynesia|Guam|Hawai'i|New Caledonia|Norfolk Island|Northern Mariana Islands|Pitcairn|Tokelau|Wallis & Futuna|Canary Islands|Azores|Madeira|Cabo Verde|Morocco|Algeria|Tunisia|Libya|Egypt|Mali|Mauritania|Senegal|Gambia|Guinea-Bissau|Guinea|Sierra Leone|Liberia|Burkina Faso|Ivory Coast|Ghana|Togo|Benin|Niger|Nigeria|Chad|Central African Republic|Cameroon|Equatorial Guinea|Sao Tome & Principe|Gabon|Republic of the Congo|Democratic Republic of the Congo|Sudan|South Sudan|Eritrea|Djibouti|Ethiopia|Somalia|Kenya|Uganda|Tanzania|Rwanda|Burundi|Angola|Namibia|Zambia|Malawi|Mozambique|Zimbabwe|Botswana|South Africa|Eswatini|Lesotho|Seychelles|Comoros|Mauritius|Mayotte|Reunion|Madagascar|Antarctica
@jdhan39 Here is the parsed list of 238 countries: MDD_countryList.txt
hey @n8upham - I took some steps towards map integration.
Roughly three parts -
for 1. I've used leafletjs.org and gadm.org to create sample page at https://www.mammaldiversity.org/map
Note the polygon for boundary of the Netherlands (iso 3166-1 alpha-3 code "NLD")
For 2. I've used wikidata to populate a lookup table https://github.com/mammaldiversity/mammaldiversity.github.io/blob/master/_data/countryCodes.csv via https://github.com/mammaldiversity/mammaldiversity.github.io/blob/master/_data/countryCodes.sh .
Following, I've generated some dynamic javascript (generated javascript) to help lookup the country codes for countries listed in countryDistributions.
So, next up would be to put 1. and 2. together and embed the map widget into the species info page.
Hey @jhpoelen -- this is fantastic. Thank you for putting these initial steps mapping together and thinking through this. You are 100% on the right track from what I can see.
Questions:
(1) Are you imagining that an expanded range map of Netherlands + Germany would == the two polygons side-by-side? That makes sense to me.
(2) Would it be possible to enable downloads of those per country maps? I see that the whole set is available here (https://datahub.io/core/geo-countries) so maybe best to just link to that
There is an aspect of this similar to the iNaturalist "Atlas" pages, which creates a political boundary background to the point occurrence and range map data -- see: https://www.inaturalist.org/pages/atlases -- I just mention that in case it gives more inspiration.
Hey @n8upham -
I implemented a first pass at the distribution map visualization. See attached for rendering of https://www.mammaldiversity.org/explore.html#genus=Tachyglossus&species=aculeatus&id=1000002
Curious to hear your thoughts.
Some notes:
matching to resolve country codes is using a lookup table derived from wikidata and https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3 . Some mappings are problematic because mdd uses the non-standard common country names (e.g., Ireland), not the standard codes (e.g., IRL). This leads to funny situations with "Republic of Ireland" (the country) vs. "Ireland" (the country and island). Note that country name in the distributions text that do not have following country code in parenthesis (e.g., Canada (CAN)
) may need some TLC to be included on the distribution map.
map library leafletjs.org is used in combination with openstreet maps. These are commonly used tools, and can be configured as desired. I've taken the fastest route to implementation, so I am sure there's way to improve the user experience. . .
Very nice! A few thoughts:
Happy to help with standardizing country names used in MDD geographical data so that they're all easy to process.
I'd say it'd be nice to use country codes instead of names . . . but @n8upham probably has some ideas on this too.
Country borders are obviously not very granular; in your example it's unfortunate that all of Indonesia is outlined when echidnas of course only occur in a small part of the country. Maybe we should show some disclaimer text stating that the true distribution may be much smaller.
please note that GADM has polygons for subdivisions also.
e.g., see attached screenshots from their Indonesia shapes, with and without subdivisions https://gadm.org/maps/IDN.html
Amazing work @jhpoelen ! I have this working on my side via Firefox and Chrome, but I had two complaints earlier today that the Search function was not working for folks. Maybe the install of the new javascript libraries is causing conflict?
It could be a separate issue, but the same folks are complaining that they need to add "www" to the URL where they used to be able to just use "mammaldiversity.org" -- mentioning that here in case its also relevant. Any thoughts?
Aside from that technical issue, I think you accomplished this task in record time Jorrit.
Adding subdivisions of the countries would be a great next step -- we actually have a 'subregionDistribution' field in the CSV, but it is only populated for certain countries + the USA. Could you implement this for the USA states with an option for it to populate as we curate additional data in the column?
Thanks much
I just noticed that no species in the USA are showing up currently -- e.g., https://www.mammaldiversity.org/explore.html#genus=Peromyscus&species=maniculatus&id=1002307 -- I think because of the country code not being there for "United States (USA)"?
I think because of the country code not being there for "United States (USA)"?
United States of America
would map to ISO 3166-1 alpha-3 country code USA.
Ah okay, then one (some hacky) way to fix this would be to add a row for:
USA,United States,http://www.wikidata.org/entity/Q30
But I wouldn't want to break this by doing that. Better would be for us to amend the CSV of the MDD taxonomy to standardize the name of "United States" to "United States of America"
Okay, turns out the MDD has "United States" in a consistent way throughout (not "United States of America") so the easier thing indeed was to change the entry in the countryCodes.csv lookup table.
I needed to make a spelling change to one species, so I did that change + this countryCode one in the v1.12.1 version update. USA maps appear to be working now!
Great to see you improvised to help align country names with the polygons published by GADM. Curious to see how MDD will end up standardizing their country names (and other terms . . . ).
re: I had two complaints earlier today that the Search function was not working for folks. Maybe the install of the new javascript libraries is causing conflict?
I am not quite sure what it means that "the search function was not working for folks." Can you provide an example?
It could be a separate issue, but the same folks are complaining that they need to add "www" to the URL where they used to be able to just use "mammaldiversity.org" -- mentioning that here in case its also relevant. Any thoughts?
Yeah, I noticed that too. Probably a DNS related issue.
I am not quite sure what it means that "the search function was not working for folks." Can you provide an example?
Yeah no worries about this one actually -- it was a vague complaint that I couldn't replicate either.
@JelleZijlstra @n8upham Just checking in on the recently added country distribution feature. Is the feature working as expected?
What new issues can we open related to this? I can think of some (e.g., use standardized country codes in addition to vernacular country names to help facilitate linking to gazetteers like GADM).
The idea would be to display a very rough world map with the country highlighted would be an interesting output -- possibly via Google tools to make it a zoom-able map