Thank you @Sudip Barman

i think you mean some thing Like this 

  var overlay = new google.maps.OverlayView();
  overlay.draw = function() {};
  overlay.onAdd = function() {
    var projection = this.getProjection();
    var pixel = projection.fromLatLngToContainerPixel(marker.getPosition());
    console.log(pixel);
  };
  overlay.setMap(map);

But this code return One point on the map , what i want to return , 
all Polyline points i think we need to loop over it 
let say i have this map :

===========================================

 
              var map;
function initMap() {
var chicago = {lat: 41.85, lng: -87.65};
var indianapolis = {lat: 39.79, lng: -86.14};
var map = new google.maps.Map(document.getElementById('map'), {
center: chicago,
scrollwheel: false,
zoom: 7
});
var directionsDisplay = new google.maps.DirectionsRenderer({
map: map
});
// Set destination, origin and travel mode.
var request = {
destination: indianapolis,
origin: chicago,
travelMode: google.maps.TravelMode.DRIVING
};
// Pass the directions request to the directions service.
var directionsService = new google.maps.DirectionsService();
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
// Display the route on the map.
directionsDisplay.setDirections(response);
}
});
} 


we have a trip direction form chicago to indianapolis :) long trip :p

now i want to return 2 things :
1- all XY points of this Trip Polyline 
2- all  lat long of each returned XY point .


Please advice !


==========================================

On Tuesday, 15 March 2016 12:27:04 UTC+2, Sudip Barman wrote:
>
> Hi Masri,
>
> you can use following to get pixel value of each point
>
>
> var tempOverlay = new google.maps.OverlayView();
> tempOverlay.draw = function () { };
> tempOverlay.setMap(glbMap);var clickLocation = 
> tempOverlay.getProjection().fromLatLngToContainerPixel(marker.getPosition()),
>     mapDivWidth = clickLocation.x,
>     mapDivHeight = clickLocation.y;
>
>
>
> mapDivWidth and mapDivHeight will carry your require values.
>
>
> Thanks,
> Sudip Barman
>
> On Tuesday, 15 March 2016 08:47:29 UTC+5:30, Bashar Al Masri wrote:
>>
>> Dear all 
>> I cant find a way to do this .
>> Here is the problem .
>>
>> I have (lat & long) of 2 places and i want to draw a Routes Polyline 
>> between .
>> Now that is easy part !
>>
>> But the hard part is:
>>
>> I want to return an array with :
>>
>> All  (lat & long)  of the draw Polyline.
>> Each  (lat & long)  has a XY position on the map base on the client 
>> screen resolution .i want to know what is the XY of each  (lat & long).
>>
>> but i dont want client to click any ware on the map ! once he open the 
>> page the info will be in the textaria  as JSON array!
>>
>> so it will be some thing like :
>>
>> 42.640122, -73.784486
>> XY: 300x500,
>>
>> 42.639846, -73.785269
>> XY: 310x605
>> ...
>> ...
>> ...
>>
>>
>> Please Advice 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-maps-js-api-v3+unsubscr...@googlegroups.com.
To post to this group, send email to google-maps-js-api-v3@googlegroups.com.
Visit this group at https://groups.google.com/group/google-maps-js-api-v3.
For more options, visit https://groups.google.com/d/optout.

Reply via email to