[OpenLayers-Users] help with geolocation/jquery/modernizr script: uncaught type error.

Nicholas Efremov-Kendall n.e.kendall at gmail.com
Sun Jun 5 19:17:13 EDT 2011


Hi Eric,

Thanks for spotting that. I've fixed it but I'm still getting a strange
error in Chrome's javascript console:

Uncaught TypeError: Object function (){var
a=null;if(this.baseLayer!=null)a=this.baseLayer.projection;return a} has no
method 'getCode'

In the OL script at line 311. Does anyone have a suggestion on a different
implementation of a button script?


On Sun, Jun 5, 2011 at 4:09 PM, Eric Lemoine <eric.lemoine at camptocamp.com>wrote:

> > var markers = new OpenLayers.Layer.Markers("Markers");var map = new
> OpenLayers.Map('map');function initGIS(){map.addControl(new
> OpenLayers.Control.LayerSwitcher());
> > var mapnik = new OpenLayers.Layer.OSM();map.addLayer(mapnik);
> map.setCenter(new OpenLayers.LonLat(-90, 38).transform(new
> OpenLayers.Projection("EPSG:4326"),map.getProjectionObject()),12);
> > }
> >
> jQuery(window).ready(function(){jQuery("#btnInit").click(getLoc);});function
> getLoc(){if (Modernizr.geolocation)
> { navigator.geolocation.getCurrentPosition(showMap,handle_error);
> > } else {yqlgeo.get('visitor',norm_yql_resp);}}
> >
> > function showMap(position){//alert('Lat: ' + position.coords.latitude + '
> ' + 'Lon: ' + position.coords.longitude + ' ' + 'Acc: ' +
> position.coords.accuracy);
> > var lonlat = new
> OpenLayers.LonLat(position.coords.longitude,position.coords.latitude).transform(new
> OpenLayers.Projection("EPSG:4326"), map.getProjectionObject);
>
> map.getProjectionObject -> map.getProjectionObject()
>
> no?
>
> --
> Eric Lemoine
>
> Camptocamp France SAS
> Savoie Technolac, BP 352
> 73377 Le Bourget du Lac, Cedex
>
> Tel : 00 33 4 79 44 44 96
> Mail : eric.lemoine at camptocamp.com
> http://www.camptocamp.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110605/0b74164f/attachment.html


More information about the Users mailing list