gbif / portal-feedback

User feedback for the GBIF API, website and published data. You can ask questions here. 🗨❓
30 stars 16 forks source link

Upload Shape Files (polygon) #415

Open gbif-portal opened 7 years ago

gbif-portal commented 7 years ago

Upload Shape Files (polygon)

Dear GBIF team,

it would be very usefull to have the possibility to upload a shape file (polygon) to get date for a certain area. The existing mechanism to draw a polygon is only very coarse. For example we want data for the state of Oberpfalz . We have a detailed shapefile for this area an want to download only data from this area.

Kind regards Marcel Ruff


fbitem-632937989213bf4e43cb42556216fa1047383e29 Reported by: ruff@bsm.mwn.de System: Firefox 54.0.0 / Windows 10 0.0.0 Referer: https://www.gbif.org/occurrence/map?dataset_key=64dabd3c-4f34-4520-b9dd-d227a0bf1582&advanced=1&geometry=POLYGON%20((10.909423828125%2048.47073621957837,%2010.953369140624998%2047.82569547877307,%2011.392822265624998%2047.74449504501057,%2011.942138671875%2047.847819038323166,%2012.073974609375%2048.18586618836662,%2011.66748046875%2048.45616620255998,%2010.909423828125%2048.47073621957837)) Window size: width 1920 - height 916 API log&_a=(columns:!(request,response,clientip),filters:!(),index:'prod-varnish-',interval:auto,query:(query_string:(analyze_wildcard:!t,query:'response:%3E499%20AND%20(request:%22%2F%2Fapi.gbif.org%22)')),sort:!('@timestamp',desc))&indexPattern=uat-varnish-&type=histogram) Site log&_a=(columns:!(request,response,clientip),filters:!(),index:'prod-varnish-',interval:auto,query:(query_string:(analyze_wildcard:!t,query:'response:%3E399%20AND%20(request:%22%2F%2Fdemo.gbif.org%22)')),sort:!('@timestamp',desc))&indexPattern=uat-varnish-&type=histogram)

rdmpage commented 7 years ago

This sounds like something that some users, at least, would find very useful. There are lots of species distribution maps that are available as shape files (e.g., IUCN). Presumably one issue is how detailed the polygon can be without impacting performance. I'm guessing the polygon(s) encoded in a shape file can be smoothed before processing. As an aside, wouldn't it be useful to have the query polygon drawn on the main map itself? Otherwise we have to mentally flip between the query and the result, losing any sense of how well our query polygon is filled.

thomasstjerne commented 7 years ago

The bottleneck will be the uri size / payload allowed by the API. Hence, simplification or smoothing of polygons would be neccessary in most cases. However, this can be done in many ways, and I think it would be difficult for the web application to make proper assumptions of how the user would want this done. Therefore we will introduce an experimental feature of allowing users to drag n drop GeoJSON and KML files to the occurrence search map. These geometries will not be simplified and the application will report if the api rejects the request beacause of the size. It will then be up to the user to do the simplification.

For detailed geodata such as county borders or similar, I would do one of the following:

MortenHofft commented 7 years ago

As an aside, wouldn't it be useful to have the query polygon drawn on the main map itself

this is also captured in https://github.com/gbif/portal16/issues/248

DimEvil commented 6 years ago

+1 for this, as I have this question coming from the Nature and Forest administration. While assessing for permits etc. it would be very useful when they just can upload a polygon and have a report back on which species are occurring in this polygon. Note that the people in that administration are not doing any GIS work, so preferably all should be in the portal, and should be doable in a simple and easy way....

MortenHofft commented 6 years ago

I'm afraid the APIs do not allow for querying with shape files. So the shape file would need to be converted into a WKT at some point. The website do not have a function for converting shape files into WKT for you, but it does accept pasting in WKT and GeoJSON.

I haven't tried any tools that always works for converting shape into geojson or wkt, but here is one: https://mygeodata.cloud/converter/shp-to-geojson

Once you have your wkt or geojson you can paste it into the portal. The APIs don't allow for arbitrary large geometries, so it will in many cases need to be simplified. The website will in some cases attempt to simplify the geometry for you (and inform you). Be aware that simplifaction comes with compromises that the user might not want (including too much or too little).

DimEvil commented 6 years ago

This works (I was not aware of this feature, but is is really cool, is this announced somewhere?, (only for simple polygons, Flanders was too big, simplified it did work))

but I'm afraid this will not be used as a tool for someone behind a desk doing administration for issuing permits etc... and want's to figure out which species are in a specific reasonable small area.

MortenHofft commented 6 years ago

really cool, is this announced somewhere?

Great - No it hasn't been announced, but has been a part of the website all along :) But well hidden it seems.

I'm afraid this will not be used as a tool for someone behind a desk doing administration for issuing permits

Perhaps building a small tool targetting that audience and that use case is better then? It is possible to get the data using the website, but a dedicated tool might be better in this case. Perhaps even a plugin to your users existing tools using the GBIF APIs?

Distinct speciesKeys from an area is easy to get using the API. API version&limit=0&facet=speciesKey) - the speciesKeys just need to be looked up to get the names. Same data as the list seen here)

DimEvil commented 6 years ago

Indeed, the small tool looks like the best option at the moment. :)