It works super in phonegap....
but put your into the onDeviceReady instead... and check your paths to
your javascripts, they seems to be off... (You just c&p from the
samples right ;-))....
And when you got this running use, the newest trunk (Openlayers) you
can get, it is much better than IOL.js when it comes to touch
events....
--
Med venlig hilsen / Kind regards
Tue Topholm
Sugee
Tlf: +45 32 13 32 32
W: http://www.sugee.dk
2011/3/18 Noli Sicad <nsi...@gmail.com>:
> --
> You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phon...@googlegroups.com
> To unsubscribe from this group, send email to
> phonegap+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/phonegap?hl=en?hl=en
>
> For more info on PhoneGap or to download the code go to www.phonegap.com
>
Thanks for your reply.
Yes, I was trying to run the openlayers jquery example in the mobile
openlayers. I got blank map.
Tue, probably you can do me a favour and the whole Phonegap community.
Please hack this simple example openlayers below to run in Phonegap.
Let hack this one and see if we can get Phonegap and overlayers working.
Post you hack and I will do the testing.
I will try to hack this example as well
Thanks,
Noli,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://openlayers.org/dev/examples/osm.html
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width;
initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>OpenLayers Basic Single WMS Example</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
<link rel="stylesheet" href="style.css" type="text/css" />
<script src="../OpenLayers.js"></script>
<script type="text/javascript">
var map, layer;
function init(){
map = new OpenLayers.Map( 'map');
layer = new OpenLayers.Layer.OSM( "Simple OSM Map");
map.addLayer(layer);
map.setCenter(
new OpenLayers.LonLat(-71.147, 42.472).transform(
new OpenLayers.Projection("EPSG:4326"),
map.getProjectionObject()
), 12
);
}
</script>
</head>
<body onload="init()">
<h1 id="title">Basic OSM Example</h1>
<div id="tags">
openstreetmap basic
</div>
<div id="shortdesc">Show a Simple OSM Map</div>
<div id="map" class="smallmap"></div>
<div id="docs">
This example shows a very simple OSM layout with minimal controls.
</div>
</body>
</html>
I tried again using a simple example in openlayers.
I still got the blank map i.e. no map at all. Just the text. No even a
reserve space for the map.
You are saying that you manage to run openlayers with Phonegap, what
version of Phonegap it was running? Could you send me the running
openlayers project or probably this one, if you can run it.
Please run this mobile openlayers one that you mentioned and see if
you can run this code.
I already put all the files in the same directory (see the code below).
Here is the code (below), updated with the mobile openlayers.
Anybody got opinion why this code does n't work?
I am using Mac OS X 10.6.4, 4.2 SDK. The latest svn openlayers.
Thanks,
Noli
~~~~~~~~~~~~~~~~~~~~
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<!-- Change this if you want to allow scaling -->
<meta name="viewport" content="width=default-width; user-scalable=no" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>OpenLayers Basic Single WMS Example</title>
<link rel="stylesheet" href="style.css" type="text/css" />
<link rel="stylesheet" href="style.css" type="text/css" />
<script src="OpenLayers.js?mobile"></script>
<script src="mobile-base.js"></script>
<script type="text/javascript" charset="utf-8"
src="phonegap.0.9.4.min.js"></script>
<script type="text/javascript" charset="utf-8">
<script type="text/javascript">
var map, layer;
function init(){
map = new OpenLayers.Map( 'map');
layer = new OpenLayers.Layer.OSM( "Simple OSM Map");
map.addLayer(layer);
map.setCenter(
new OpenLayers.LonLat(-71.147, 42.472).transform(
new OpenLayers.Projection("EPSG:4326"),
map.getProjectionObject()
), 12
);
}
function onBodyLoad() {
document.addEventListener("deviceready",onDeviceReady,false);
}
/* When this function is called, PhoneGap has been initialized and is
ready to roll */
function onDeviceReady()
{
init();
}
</script>
</head>
<body onload="onBodyLoad()">
<h1 id="title">Basic OSM Example</h1>
I will try it on Monday on my machine...
but can you get anything to work, is onDeviceReady triggered....
--
Med venlig hilsen / Kind regards
Tue Topholm
Sugee
Tlf: +45 32 13 32 32
W: http://www.sugee.dk
2011/3/19 Noli Sicad <nsi...@gmail.com>:
Please do.
Hope to iron out this thing.
Looking forward to see a running Openlayers in iPhone in Xcode + Phonegap.
I will have another go later today. This time I will use the online
resources - mobile openlayers (below).
You can probably use this one as well.
Thanks.
Regards, Noli
~~~~~~~~~
<link rel="stylesheet"
href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.css">
<script src="http://code.jquery.com/jquery-1.5.min.js"></script>
<script
src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js"></script>
<link rel="stylesheet"
href="http://openlayers.org/dev/examples/style.mobile.css"
type="text/css">
<link rel="stylesheet"
href="http://openlayers.org/dev/examples/style.mobile-jq.css"
type="text/css">
<script src="http://openlayers.org/dev/OpenLayers.mobile.js"></script>
<!--<script src="http://openlayers.org/dev/lib/OpenLayers/Layer/Image.js"></script>-->
<script src="mobile-base.js"></script>
<script src="mobile-jq.js"></script>
is phonegap.js in your root folder?