[OpenLayers-Dev] RE: CacheRead and CacheWrite with Web SQL Storage?

Dominik Mikiewicz dominikmikiewicz at o2.pl
Wed Apr 4 03:17:20 EDT 2012


Andrew,

I haven't had a chance to play with these cool cotrols yet but from what I
see fetching data asynchronously should not be a problem indeed.
In the fetch method you have the access to a tile so you can pass it along
with your async calls and then modify the tile imgSrc when completed.

Try something like this (not tested):

getTileData : function(tile){
 		
	this.db.transaction(
		function(tx){
	 		tx.executeSql(
				'HereGoesYourSql;',
				[andParams],
				function (tx, results) { //success callback
					if(results.rows.length == 1){
						var tileCache =
results.rows.item(0);
						
	
tile.setImgSrc(tileCache.data);
					}
				},
				function(tx, error){ //error callback
				}
			);
		}
	);
}

Hope this help

dom 

-----Original Message-----
From: openlayers-dev-bounces at lists.osgeo.org
[mailto:openlayers-dev-bounces at lists.osgeo.org] On Behalf Of Vardeman,
Andrew [CSSM]
Sent: Tuesday, April 03, 2012 10:47 PM
To: openlayers-dev at lists.osgeo.org
Subject: [OpenLayers-Dev] RE: CacheRead and CacheWrite with Web SQL Storage?

Okay, I've started on this and have the OpenLayers.Control.CacheWrite.cache
part working (tiles are getting cached to the Web SQL DB), but I think I've
run into a problem with the OpenLayers.Control.CacheRead.fetch method.  I'm
not quite sure what's happening, but it appears that the fetch method needs
to complete synchronously for the dataURL it supplies to be used as the
image src.  Does that sound right?  If so, I think I'm dead in the water.

Andrew

-----Original Message-----
From: openlayers-dev-bounces at lists.osgeo.org
[mailto:openlayers-dev-bounces at lists.osgeo.org] On Behalf Of Vardeman,
Andrew [CSSM]
Sent: Monday, April 02, 2012 1:44 PM
To: openlayers-dev at lists.osgeo.org
Subject: [OpenLayers-Dev] CacheRead and CacheWrite with Web SQL Storage?

Hi, OpenLayers developers.  This is my first email; I hope I'm posting this
to the proper list.

I'm interested in the work done here:

https://github.com/openlayers/openlayers/pull/301

The pull request says that "even asynchronous backends could be added."  By
any chance, is anyone working on Web SQL Storage version or the mentioned
pluggable version with multiple backends?  I need such a thing for my
current project, so I'll probably try if no one else is already doing it.
If I get something working that's sufficiently generic, I'll submit it as a
patch.

Thanks,

Andrew Vardeman

_______________________________________________
Dev mailing list
Dev at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-dev
_______________________________________________
Dev mailing list
Dev at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-dev



More information about the Dev mailing list