ushahidi / Ushahidi_Web

Ushahidi v2. A platform that allows information collection, visualization and interactive mapping, allowing anyone to submit information through text messaging using a mobile phone, email or web form.
http://www.ushahidi.com
Other
901 stars 624 forks source link

Feature: Cache map tiles - or use static map images. #580

Open lbell opened 12 years ago

lbell commented 12 years ago

This might violate the various map-provider licenses, but given that I (and my target audience) will be using Ushahidi over GSM cell-phone networks (no 3g here...) is it possible to cache map tiles? These are currently the laggiest part of the experience -- often not loading at all.

As a second-best: provide the option for a geo-referenced static image (aerial imagery?) to be used - and only engage the map server beyond a certain zoom (if at all).

I see some discussion around this here: http://forums.ushahidi.com/topic/gmaps-offline but don't see the Frontline plugin providing this feature anymore.

Also worth nothing, Google Maps is now allowing the Android Version to store local copies of tiles for offline use... perhaps their rules are loosening?

robertdbuckley commented 12 years ago

An alternative idea would be to simply include the WMTS/TMS protocol in the openlayers Ushahidi script. This would provide the ability to serve custom basemaps which are then cached and served on the same server. I am using a similar setup which instead provides GeoWebCache Tiles served out of geoserver. These are Grouped WMS layers which are binded into Ushahidi as a custom layer by modifying the map.php script. Here is an example. http://maps.zgb.de/punktekarte/

Geoserver and GeoWebCache serve and cache wms layers. The geometries are stored in a PostgreSQL database using the PostGIS spatial extention. You can even cascade wms services meaning that wms data served from other OGC servers can be served and cached through your own server!

If you want more info or if I can help you further please let me know,

yours, robertdbuckley

lbell commented 12 years ago

@robertdbuckley Is there a "straightforward" way to do this? For my current deployment, I need one (1) static map tile to land on. That is enough resolution for 70% of our reports. That's it. If people zoom, then I'll kick it back to regular channels.

robertdbuckley commented 12 years ago

sure there are easier more straightforward ways - All depends on the type of basemap needed. I´ll get in touch on monday when I´m back in the office.

robertdbuckley commented 12 years ago

Hi lbell. Can you write me a few things about what kind of basemap you are thinking of and what type of data you have and in what format, and what GIS software you have? Are you using a hosted version of crowdmap or are you hosting ushahidi from your own server? Do you have root ssl access if it is hosted?

lbell commented 12 years ago

-- Basemap: Geo-referenced Image (anything from aerial photo to hand-drawn sketch**) referenced against field-collected GPS points. Need imported KML layers active too. -- GIS Software: Keeping it simple with QGIS -- Ushahidi: Individual deployment on shared server (have ssh access if that's what you mean)

**Pulling an opengeo image (if that's allowed) would be a great option.

Basically, the first thing people get when they land is an image - like any other image - served off my server quickly. Then if they scroll, zoom, etc, it should shift to google - or whoever else.

Thanks for the help.

robertdbuckley commented 12 years ago

so you want dynamic scale-dependant layers..ie depending on what zoom level you are on the basemap changes? what do you by "Pulling an opengeo image"...are you using the opengeosuite?

lbell commented 12 years ago

Sorry - just scratch that opengeo bit (I was referring to grabbing the desired map and copying it my server from somewhere - though I assume Google etc frowns on this... )

As for scale / zoom - simplest case (and the one I need is) is simply to have the initial landing page map -- zoomed to whatever extent selected in the settings (map setup) -- to be served from a local image. That is it. Once the user wants to zoom in - then they can take the bandwidth hit.

For the ultimate in responsiveness, the entire map (zoomed, panned, etc. whathaveyou) would be served from locally stored tiles that I could set the resolution / make as small as functionally possible. But I don't really need this.

My primary concern is that when initially loading the site over a GSM connection, the map often fails to load - and/or bogs the rest of the site down. I would like the initial visit to be quick - allow for use to click on a few report 'pins' etc, overlayed on that locally served image. And then if they decide they want to go deeper (zoom, pan, etc) they can wait for the download.

Does that make sense?

robertdbuckley commented 12 years ago

If you want local tiles, we are going to have to have a look at the openlayers TMS layer protocol which isn´t (afaik) a standard part of the ushahidi-layers mapping script (althought the openlayers library supports TMS and WMTS). It would be possible to adapt your mapping scripts to accomodate this though, but I can´t say how much work this would be. The mapping side has been rewritten to allow for easier adaption apparently..but it´s new and could be time consuming. It might be possible to define a local georeferenced image at a specific zoom level. If I get a chance this week, I´ll have a look at the new ushahidi mapping scripts. It might also be worth asking Robbie McKay if he could help. http://openlayers.org/dev/examples/wmts.html http://openlayers.org/dev/examples/tms.html

lbell commented 12 years ago

Yeah, I assumed that would be a beast. Hence my priority is simply to handle the "first impression" of the site by sending one static image to the user.