google-polyline

How to add a random point inside a polygon in Google Maps?

一个人想着一个人 提交于 2019-12-07 02:16:40
I have a bounds to a place and created a polygon of that place. How can I generate a random point inside the bounds of that polygon? One way of doing it. This will calculate the bounds of the polygon, then guess a random point inside that bounds, if the point is contained by the polygon, it will put a marker there. // calculate the bounds of the polygon var bounds = new google.maps.LatLngBounds(); for (var i=0; i < polygon.getPath().getLength(); i++) { bounds.extend(polygon.getPath().getAt(i)); } var sw = bounds.getSouthWest(); var ne = bounds.getNorthEast(); // Guess 100 random points inside

Polyline not visible Android Maps Api v2

三世轮回 提交于 2019-12-06 20:53:29
I am a little bit confused since everything seems to be alright with the code. The problem is that the polyline won't show up on the map. Here is the function that I call to place polyline everytime I receive a location (I added markers in a similar way and they work great) private void addPolylineLocationOnMap(LatLng newLoc) { PolylineOptions poly = new PolylineOptions() .add(newLoc) .color(Color.BLUE) .width(5) .visible(true) .zIndex(30); googleMap.addPolyline(poly); } A Polyline needs multiple points! For example, pass an ArrayList<LatLng> to your method and use addAll() rather than just

Google maps api parallel path lines

让人想犯罪 __ 提交于 2019-12-06 08:59:33
问题 I am working on a sort of itinerary mapper for packaged vacations, and I'm really happy with what I've done so far; I have the directions api implemented with a custom renderer, so I can take driving directions, and plot my own polyline complete with directional arrows that aren't google's awful ones spaced along the path. I am not exactly a math expert, and I am trying to figure out how I could make a path parallel to another path. For example, the itinerary goes from city 1 to city 2, and

Draw google polyline with line width set in meters

戏子无情 提交于 2019-12-06 03:37:20
I noticed that when you draw a polyline in google maps you set it's width in pixels (strokewidth). Is there a way I could set that in metres instead? Unfortunately, I don't know any easy way to do this. The API does not appear to have documentation on this and I assume this feature is unsupported. One problem is that the pixels represent a different number of meters at different zoom levels within the API. So it would be a dynamic quantity if the zoom levels are changed. One option might be to compute the width in pixels for representing a given number of meters for a given zoom level. For

Android Draw polylines with arrow on google map with direction path

情到浓时终转凉″ 提交于 2019-12-04 13:13:50
问题 I have added polylines but not able to add arrow with direction on google map should be display as below And when it zoom up, more arrow should be display like below I have tried reading various blogs and codes but not able to get the goal I have used following code snippet below: private void DrawArrowHead(MarkerOptions MO, GoogleMap mMap, LatLng from, LatLng to) { // obtain the bearing between the last two points double bearing = GetBearing(from, to); // round it to a multiple of 3 and cast

Android Draw polylines with arrow on google map with direction path

岁酱吖の 提交于 2019-12-03 08:20:45
I have added polylines but not able to add arrow with direction on google map should be display as below And when it zoom up, more arrow should be display like below I have tried reading various blogs and codes but not able to get the goal I have used following code snippet below: private void DrawArrowHead(MarkerOptions MO, GoogleMap mMap, LatLng from, LatLng to) { // obtain the bearing between the last two points double bearing = GetBearing(from, to); // round it to a multiple of 3 and cast out 120s double adjBearing = Math.round(bearing / 3) * 3; while (adjBearing >= 120) { adjBearing -=

How to draw routes between two locations in google maps iOS swift

戏子无情 提交于 2019-12-03 00:19:59
I'm using google maps in my iOS swift project. I want to draw a path between two locations on the map (Not straight line). Any idea how to do that ? Ashish Shah To draw polyline between two locations on Google Map in Swift. // Pass your source and destination coordinates in this method. func fetchRoute(from source: CLLocationCoordinate2D, to destination: CLLocationCoordinate2D) { let session = URLSession.shared let url = URL(string: "http://maps.googleapis.com/maps/api/directions/json?origin=\(source.latitude),\(source.longitude)&destination=\(destination.latitude),\(destination.longitude)

Google Maps API v3 SVG markers disappear

做~自己de王妃 提交于 2019-12-02 22:33:05
I am using SVG path notation to create markers along with a polyline using Google Maps API v3. Sometimes, after adding a few markers, they just stop showing from the map. If I pan the map, even just 1px, they show again. SVG markers stop showing after adding a few SVG markers show again after pan This happens in FF, Safari, Chrome and iPhone browsers. Here is my code for the polyline: var lineSymbol = { path: g.SymbolPath.FORWARD_OPEN_ARROW, scale:1.5 }; polyOptions = { strokeColor: '#0026b3', strokeOpacity: 1.0, strokeWeight: 1, geodesic: true, icons: [{ icon: lineSymbol, repeat: '100px' }],

undesired polyline rendering while zooming in and out google maps

爷,独闯天下 提交于 2019-12-02 17:51:05
问题 rendering reflected image of the polyline I have an application to draw a polyline on latitude and longitude values which are fetched dynamically. I'm able to form the polyline perfectly but I see a reflected polyline forming somewhere around the map as I extend the polyline asynchronously which is undesirable (i get this issue even if I don't change the zoom of the map). please help me avoid that reflection 回答1: This is likely a Chrome browser issue. The corresponding bug in the public issue

Marker Animation not working on Google Maps API?

徘徊边缘 提交于 2019-12-02 16:45:12
问题 I want to animate a marker on a route defined between a source and a destination. I got a working example code to understand but it does not seem to be working. When i click on Start Button, I get a javascript error. Object does not support this property or method on the line. eol=poly.Distance(); Please find the below code. Request you all to please guide if i am missing anything. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">