<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>
<channel>
	<title>LiquidFoot &#187; gis</title>
	<atom:link href="http://www.liquidfoot.com/tag/gis/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.liquidfoot.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Mon, 02 Jan 2012 22:56:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Openlayers and Mobile Devices</title>
		<link>http://www.liquidfoot.com/2009/11/25/openlayers-and-mobile-devices/</link>
		<comments>http://www.liquidfoot.com/2009/11/25/openlayers-and-mobile-devices/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 15:03:09 +0000</pubDate>
		<dc:creator>Wayne</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[gis]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[openlayers]]></category>
		<guid isPermaLink="false">http://www.liquidfoot.com/?p=326</guid>
		<description><![CDATA[After some really good conversations last week at the Institute on Enabling Geospatial Scholarship about mobile devices and mapping as an interpretive device, I mocked up a quick page to see how OpenLayers looked on the Safari mobile browser. The theory to test out here was that you could pretty easily pull up your current [...]]]></description>
			<content:encoded><![CDATA[<p>After some really good conversations last week at the Institute on Enabling Geospatial Scholarship about mobile devices and mapping as an interpretive device, I mocked up a quick page to see how <a href="http://openlayers.org/">OpenLayers</a> looked on the Safari mobile browser. The theory to test out here was that you could pretty easily pull up your current location and plot your (approximate) location on a historic map (or any map for that matter) without having to install an application (like <a href="http://emergencestudios.com/historicearth/">Old Map App</a>). There are various hurdles in higher education to actually releasing software application through vendors like Apple&#8217;s App Store (restrictions on individual employees entering into contractual agreements), so we thought we&#8217;d explore using the browser to provide some of this functionality to users.</p>
<p>We have a few historic maps from our McGregor collection available through our <a href="http://geoserver.org">Geoserver</a> installation, so I looked up their layer ids and manually added them into a page with OpenLayers. Nothing fancy here, just a test to see what it looks like.</p>
<pre class="brush: jscript; title: ; notranslate">
var lat, long layer;
var zoom = 10;
var lat, lon, layer;
 var zoom = 10;
 map = new OpenLayers.Map('map');
 map.addControl(new OpenLayers.Control.LayerSwitcher());
 layer1 = new OpenLayers.Layer.WMS(&quot;Map of the Southern States&quot;,
 &quot;http://lat.lib.virginia.edu:8080/geoserver/gwc/service/wms&quot;,
 {layers: &quot;McGregor:000003056_00011&quot;}
 );
 layer2 = new OpenLayers.Layer.WMS(&quot;Nova Virginae tabula&quot;,
 &quot;http://lat.lib.virginia.edu:8080/geoserver/gwc/service/wms&quot;,
 {layers: &quot;McGregor:000003482_00011&quot;}
 );
 layer3 = new OpenLayers.Layer.WMS(&quot;A map of the most inhabited part of Virginia&quot;,
 &quot;http://lat.lib.virginia.edu:8080/geoserver/gwc/service/wms&quot;,
 {layers: &quot;McGregor:000003012_st1&quot;}
 );
 layer4 = new OpenLayers.Layer.WMS(&quot;Carte de la campagne en Virginie du Major General Mis. de la Fayette&quot;,
 &quot;http://lat.lib.virginia.edu:8080/geoserver/gwc/service/wms&quot;,
 {layers: &quot;McGregor:000003013_st1&quot;}
 );
 layer5 = new OpenLayers.Layer.WMS(&quot;Carte de la campagne en Virginie du Major General Mis. de la Fayette&quot;,
 &quot;http://lat.lib.virginia.edu:8080/geoserver/gwc/service/wms&quot;,
 {layers: &quot;McGregor:000003019_00011&quot;}
 );
 map.addLayer(layer1);
 map.addLayer(layer2);
 map.addLayer(layer3);
 map.addLayer(layer4);
 map.addLayer(layer5);
if(navigator.geolocation){
 navigator.geolocation.getCurrentPosition(function(position){
 lat = position.coords.latitude;
 lon = position.coords.longitude;
 map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
 var vectorLayer = new OpenLayers.Layer.Vector(&quot;Overlay&quot;);
 var feature = new OpenLayers.Feature.Vector(
 new OpenLayers.Geometry.Point(lon, lat),
 {some:'data'},
 {externalGraphic: 'http://geocoder.ca/marker.png', graphicHeight: 64, graphicWidth: 48});
 vectorLayer.addFeatures(feature);
 map.addLayer(vectorLayer);
 });
 }
map.addControl(new OpenLayers.Control.PanZoomBar());
</pre>
<p>This actually worked surprisingly well the first time I launched it. With Firefox 3.5 I tested it on my laptop. At first I wasn&#8217;t using the <a href="http://geoserver.org/display/GEOSDOC/5.+GWC+-+GeoWebCache">geowebcache</a> we had set up, so it was a bit slow. I changed to the geowebcache WMS service and things in the browser were noticeably faster.</p>
<p>At lunch, I handed an iPhone to <a href="http://iconocla.st/">Schuyler Erle</a> who&#8217;s first instinct was to try to drag things around and zoom-in and out. Well, there was a fail as the controls you normally use in OpenLayers were far too small to actually be useful and it just didn&#8217;t feel right.</p>
<p>I then attempted to add in a touchHandler function to help with the interactions from the user. I found Ross Boucher&#8217;s post &#8220;<a title="Permanent Link: iPhone Touch Events in JavaScript" rel="bookmark" href="http://rossboucher.com/2008/08/19/iphone-touch-events-in-javascript/">iPhone Touch Events in JavaScript</a>&#8221; and used his code to get the sliding working:</p>
<pre class="brush: jscript; title: ; notranslate">
function touchHandler(event)
{
   var touches = event.changedTouches,
   first = touches[0],
   type = &quot;&quot;;
   switch(event.type)
   {
     case &quot;touchstart&quot;: type = &quot;mousedown&quot;; break;
     case &quot;touchmove&quot;:  type=&quot;mousemove&quot;; break;
     case &quot;touchend&quot;:   type=&quot;mouseup&quot;; break;
     default: return;
 }
 // initMouseEvent(type, canBubble, cancelable, view, clickCount,
 // screenX, screenY, clientX, clientY, ctrlKey,
 // altKey, shiftKey, metaKey, button, relatedTarget);
    var simulatedEvent = document.createEvent(&quot;MouseEvent&quot;);
    simulatedEvent.initMouseEvent(type, true, true, window, 1,
    first.screenX, first.screenY,
    first.clientX, first.clientY, false,
    false, false, false, 0/*left*/, null);
    first.target.dispatchEvent(simulatedEvent);
    event.preventDefault();
 }
 document.addEventListener(&quot;touchstart&quot;, touchHandler, true);
 document.addEventListener(&quot;touchmove&quot;, touchHandler, true);
 document.addEventListener(&quot;touchend&quot;, touchHandler, true);
 document.addEventListener(&quot;touchcancel&quot;, touchHandler, true);
</pre>
<p>Now the scrolling worked, but you could no longer zoom into the map (and we want real zoom, not just making the image bigger). I haven&#8217;t found a fix for this yet, but I have to say that this is a kind of cool way of interacting with these materials.</p>
<p>Something I need to talk with Joe about next week making your location a query to <a href="http://geonetwork-opensource.org/">Geonetwork</a> and then using the top n maps returned to build this interface. It&#8217;s a little like a coverage map for your current location.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.liquidfoot.com/2009/11/25/openlayers-and-mobile-devices/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

