Getting layers to work on Ushahidi is a constant community discussion. This wiki article is to write about what works, what needs work and what to expect. Ushahidi uses Open Layers at the moment. We have some team members playing with Leaflet too.
There are a number of tickets open about layers. The biggest user of layers is the Standby Task Force. The purpose of this page is to help better define the issues and hopefully resolve it.
Old tickets:http://dev.ushahidi.com/issues/show/2240
New tickets on github for Ushahidi platform, Request for help on Crowdmap (private repo)
Layers and Crowdmap
Crowdmap allows for KML file uploads as "Layers" on our map -- Layers are contextual information available as an overlay to the reports. If organizations are looking to import data points from KML files act active reports within Ushahidi, that is not an option. The CSV format is currently our only option for that.
WMS Layers
What is it?
"A Web Map Service (WMS) is a standard protocol for serving georeferenced map images over the Internet that are generated by a map server using data from a GIS database" http://en.wikipedia.org/wiki/Web_Map_Service
How does it work?
WMS is currently only supported through custom code. There's no UI for add WMS baselayers or overlays in Ushahidi yet.
WMS as alternative to KML: Rather than importing an overly complex KML direct to Ushahidi. If you run a WMS server, such as geonode, you can import the source data (ie. shape files) and convert it to whatever format you need: KML or WMS.
KML Layers
What is it?
KML is an XML based format for geographic data, most notably used by Google Maps and Google Earth. More info: http://en.wikipedia.org/wiki/Keyhole_Markup_Language
How does it work?
Support for KML layers is built in to Ushahidi core. This allows you to add KML layers from an uploaded file or URL and overlay them on your map.
However this is based on Openlayers KML support and so has some limitations.
Problems & troubleshooting:
- KML layers from other domains not loading.
This could be Issue #231.
As part of browser security policies, some domains will not allow requests direct from other domains.
Theres no simple way around this: Try downloading the KML and uploading the file directly into Ushahidi, rather than including it from the URL. - Invalid KML layers
Check: Can you load this KML layer in google maps? (goto maps.google.com and paste the url into the search box)
Can you load this KML layer in google earth?
If either of these do not work, the layer is unlikely to work in Ushahidi - Overly complex KML
For some reason, complex KML files cause issues with Ushahidi. This is probably because all the rendering happen in the browser, and its simply too slow.
If you have a KML with lots of features, one work around is to load this into Google Earth and export the KML layer into multiple different KML layers.
Loading these separately may be more successful. - There may still be an issue with KML layers in IE Issues #324
- OpenLayers doesn't support GroundOverlay tags in KML files
See https://github.com/ushahidi/Ushahidi_Web/issues/946 and http://gis.stackexchange.com/questions/16816/does-openlayers-supports-kml-ground-overlays for more info
Code:
KML related plugins
- KML on by default
Lets you set any KML layers to be displayed by default on the homepage ushahidi map - KML plugin
Generate KML output from Ushahidi reports
2 Comments
Hide/Show CommentsHeather Leson
Notes from the SBTF:
There are two hacks around this. The first one (and the problem with icons) is nicely described here:http://forums.ushahidi.com/topic/kmz-files-with-embedded-images-are-not-being-extracted-properly Note that this works for ushahidi not for crowdmap.
The second hack is to load the layer onto some other online mapping platform (we've tried googlemaps and geocommons), fix the icons on the platform and then load the layer on ushahidi by linking to the url on the other platform (instead of loading the file onto ushahidi platform directly). This works for both ushahidi and crowdmap.
Amy Noreuil
I have a question about KML layers. Can you upload a choropleth KML file or will the instance always change the polygons to a single color?