I am using the following code to add a shape to the map by using jquery, jqueryui-map and google maps API
$('#map_canvas').gmap('getCurrentPosition', function(position, status) {
if ( status === 'OK' ) {
var clientPosition = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
$('#map_canvas').gmap('addMarker', {'position': clientPosition, 'bounds': false});
$("#map_canvas").gmap("option", "center", clientPosition);
$('#map_canvas').gmap('option', 'zoom', 14);
$('#map_canvas').gmap('addShape', 'Circle', {
'strokeColor': "#008595",
'strokeOpacity': 0.8,
'strokeWeight': 2,
'fillColor': "#008595",
'fillOpacity': 0.35,
'center': clientPosition,
'radius': 50,
'clickable': false });
}
});
I also tried to call the .addShape method on $(‘#map_canvas’). but I only get the following Error:
Uncaught TypeError: Cannot call method 'apply' of undefined jquery.ui.map.js:46
$.a.$.fn.(anonymous function) jquery.ui.map.js:46
e.extend.each jquery.min.js:2
e.fn.e.each jquery.min.js:2
$.a.$.fn.(anonymous function) jquery.ui.map.js:40
(anonymous function) :8080:397
$.extend.getCurrentPosition
Does anyone know how to solve this issue? The example on http://jquery-ui-map.googlecode.com/svn/trunk/demos/jquery-google-maps-geolocation.html works for some reason.. I am just not able to figure out the actual difference.. Maybe I am to blind right now 😉
Thanks,
Pat
Had the same issue, spawning from the same documentation which failed to mention to include
jquery.ui.map.overlays.jsThe code says
when in fact you need
In fact, tested and it works without
jquery.ui.map.extensions.js