Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Highlighted
Developer
Posts: 19
Registered: ‎03-28-2013
My Device: www
My Carrier: www
Accepted Solution

Google Maps Marker display in WebView

 When i set the marker with draggable : true, it shows the Pin correctly ...

 

There is anyone know how to slove the problem? please tell me。

 

Developer
Posts: 133
Registered: ‎05-10-2013
My Device: Blackberry Z10
My Carrier: -

Re: Google Maps Marker display in WebView

yaolei wrote: "it shows the Pin correctly ..."


Could you elaborate on your problem?

----------------------------------------
Remember to mark the thread as solved at the post that solved your problem, and if you like a post, like it!
Developer
Posts: 19
Registered: ‎03-28-2013
My Device: www
My Carrier: www

Re: Google Maps Marker display in WebView

I use Google Maps in the WebView. Code:

 

<!DOCTYPE html>
<html>
<head>
<title>Google Maps</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />


<link rel="stylesheet" href="local:///assets/style.css" type="text/css" media="screen" />

<script src="https://maps.googleapis.com/maps/api/js?sensor=true&libraries=places"></script>
<script src="local:///assets/google_map.js"></script>


<script type="text/javascript">
function load(){
initMaps();
}
</script>

</head>
<body>
<body onload="load()">
<div id="map_canvas"></div>

</body>
</html>

 

function initMaps() {

var myLat = 30.51667;
var myLon = 114.31667;
var rendererOptions = {
draggable: true
};
directionsDisplay = new google.maps.DirectionsRenderer(rendererOptions);

myLocation = new google.maps.LatLng(myLat, myLon);
var mapOptions = {
zoom : 14,
center : myLocation,
mapTypeId : google.maps.MapTypeId.ROADMAP,
panControl: false,
zoomControl: false,
mapTypeControl: false,
scaleControl: false,
streetViewControl: false,
overviewMapControl: false
};

googleMap = new google.maps.Map(document.getElementById("map_canvas"),
mapOptions);

initCenter(myLat, myLon);
var marker = new google.maps.Marker({
position: myLocation,
map: googleMap,
icon: 'local:///assets/images/user.png'
});

markersArray.push(marker);
i
service = new google.maps.places.PlacesService(googleMap);

directionsDisplay.setMap(googleMap);

 

}

 

The problem is:  the marker show incorrect.  It shows a big image in wrong place. But when i set zhe marker with draggable , it shows the image correctly;

 

 

 

Developer
Posts: 19
Registered: ‎03-28-2013
My Device: www
My Carrier: www

Re: Google Maps Marker display in WebView

I had slove the problem.
var marker = new google.maps.Marker({
position: myLocation,
map: googleMap,
icon: 'local:///assets/images/user.png',
optimized: false
});

add optimized: false.......
Developer
Posts: 692
Registered: ‎08-09-2010
My Device: Not Specified

Re: Google Maps Marker display in WebView

May i know how to show multiple pin ??