Hi,
I have developed mobile application using Jquery mobile, Phonegap for IOS and Android and I would like add OpenStreenMap to my application. I tried code from http://wiki.openstreetmap.org/wiki/OpenLayers_Simple_Example in my application, and I changed only this rows
map = new OpenLayers.Map("divMap");// my change name of div element
var mapnik = new OpenLayers.Layer.OSM();
var fromProjection = new OpenLayers.Projection("EPSG:4326");
var toProjection = new OpenLayers.Projection("EPSG:900913");
var position = new OpenLayers.LonLat(latitude,longitude).transform( fromProjection, toProjection);// my change, latitude and longitude are valid values of my geolocation
var zoom = 15;
map.addLayer(mapnik);
map.setCenter(position, zoom );
This code is in a function, that runs after user clicks on button.
Result - I see “button” on left top side (+,-) and on right-down side I see “Data CC-By-SA by OpenStreetMaps”
This result I see twice bellow.
If I click on button +, in error console I see thsi error -
TypeError: ‘null’ is not an object (evaluating ‘this.size.w’)
If I run this code in desktop browser, result is the same. This is extract from Firebug
Please, can anybody help me?
Regards