polyline

How to calculate the distance of a polyline in Leaflet like geojson.io?

馋奶兔 提交于 2019-12-04 04:41:57
I am working on a map with Mapbox and Leaflet and I am supposed to let the user draw polygons and calculate and show the are of that polygon and I also need to let the user draw a polyline and show the distance of the polyline. I have figured out the polygon area feature but I cannot figure out how to calculate the distance of a polyline. My code is as follows: loadScript('https://api.tiles.mapbox.com/mapbox.js/plugins/leaflet-draw/v0.2.2/leaflet.draw.js', function(){ loadScript('https://api.tiles.mapbox.com/mapbox.js/plugins/leaflet-geodesy/v0.1.0/leaflet-geodesy.js', function(){ var

Android Polyline - Adding point by point

会有一股神秘感。 提交于 2019-12-04 03:28:47
I'm currently having a map, and each 10 meters I use LocationListener to refresh my location and get the new Latitude and Longitude. Now I wish that the route the user is taking will be displayed with a red line. So everytime the OnLocationChange() from LocationListener class is called, I want to update the map with a line between the last location and the new location. So far I've added the following: private void initializeDraw() { lineOptions = new PolylineOptions().width(5).color(Color.RED); lineRoute = workoutMap.addPolyline(lineOptions); } during the OnLocationChanged I call this:

Android Map: How to animate polyline on Map?

浪子不回头ぞ 提交于 2019-12-03 20:40:34
When I plot my polyline on Map from point A -> B, I have a requirement to draw the polyline with animation. As if from A-> B the polyline keeps on drawing. I have used below link for reference: https://github.com/amalChandran/google-maps-route-animation Using the solution I am able to animate the polyline, but the polyline itself is not proper. It doesn't go through road. Original APK of the solution also has the same bug. Can someone pls help me with a suitable solution You can try with this reference also https://github.com/mohak1712/UberUX?utm_source=android-arsenal.com&utm_medium=referral

Smoothing GPS tracked route-coordinates

假装没事ソ 提交于 2019-12-03 17:06:47
I have some data of coordinates that I recorded. Unfortunatelly they seem to be not realy good. They jump sometimes over the map. So now I´m searching for some flattening or filtering algorithm that would make the route look more realistic. Currently my only filter is to calculate the max possible meters travelled in a second (in bus or car or walking) and compare them with the coordinates, throwing those away, that are just not possible within a timeframe. So if a person can walk up to 2.5 meters in a second, and I have two coords that are 10 meters away from each other and they were recorded

Check user is following the route or not (iphone)

我的未来我决定 提交于 2019-12-03 06:27:48
问题 i am making an navigation based application. In this application i am drawing a route from points selected by the user. I have requirement of recalculating route if user is not following the route. for Calculating the route i have used Google direction API . and for drawing the route i have used this code - (void) drawRoute:(NSArray *) path { NSInteger numberOfSteps = path.count; [self.objMapView removeOverlays: self.objMapView.overlays]; CLLocationCoordinate2D coordinates[numberOfSteps]; for

zoom over specific route google map

不打扰是莪最后的温柔 提交于 2019-12-03 06:08:59
I have a list of random latitude and longitude points and I am drawing a route between them. My question is how to bound this route within google map I made below utility method public static void drawRouteIntoMap(final List<? extends MapHelper> position, final GoogleMap googleMap) { /*List<MapHelper> position = new ArrayList<MapHelper>(); for (int i = lastPosition; i < maps.size(); i++) { position.add(maps.get(i)); }*/ if (position.size() > 0 && Validator.isNotNull(googleMap)) { googleMap.clear(); List<PolylineOptions> polylineOptionses = new ArrayList<PolylineOptions>(); PolylineOptions

Google Maps API: Calculate Center/Zoom of Polyline

僤鯓⒐⒋嵵緔 提交于 2019-12-03 05:39:45
问题 I have an overlay that is dynamically generated from user data, so I need to know how to find the center of that overlay. Currently, I am just using the first coordinates from the overlay, but that really does not represent the center of the overlay. Therefore when I load the map, it is not centered on the overlay. Does anyone have a good method for centering the map on the overlay, by calculating the center, not hard coding it? var latlng = new google.maps.LatLng(38.269239, -122.276010); var

Draw MKPolyline Fill Color

不羁的心 提交于 2019-12-03 04:27:59
I am attempting to draw a nice MKPolyline on an MKPolylineView . Everything is going great so far - the polyline draws just as I want it to and when I want it to using the following code: [[self map] addOverlay:routeLine]; And this method to tell the app how to draw it: - (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id <MKOverlay>)overlay { MKOverlayView* overlayView = nil; self.routeLineView = [[MKPolylineView alloc] initWithPolyline:[self routeLine]]; [[self routeLineView] setFillColor:[UIColor colorWithRed:167/255.0f green:210/255.0f blue:244/255.0f alpha:1.0]]; [[self

Multiple polylines and infowindows with Google Maps V3

人盡茶涼 提交于 2019-12-03 00:39:30
I have a map with multiple polylines and would like to open a line-specific-infowindow when clicking the line. So far my code only shows the content of the last iteration. I found two very nice examples of what I want but after hours of trying I am still no further. Example 1: http://srsz750.appspot.com/api3/polylines-multiple.html Example 2: http://www.geocodezip.com/v3_GenericMapBrowser.asp?filename=flights090414.xml So your are my last shot :-S Here is my code that shows only the content of the last iteration: for (var i = 0; i < locations.length; i++) { var route = locations[i]; //

How to display a moving track on Android device

我们两清 提交于 2019-12-03 00:35:13
I want to plot my track using GPS on an Android device. I have no problem displaying a completed route but am finding it difficult to show the track as I'm moving. So far, I've found 2 different ways to do that but neither are particularly satisfactory. METHOD 1 PolylineOptions track = new PolylineOptions(); Polyline poly; while (moving) { Latlng coord = new LatLng(lat,lng); // from LocationListener track.add(coord); if (poly != null) { poly.remove(); } poly = map.addPolyline(track); } ie build up the polyline removing it before adding the new coordinates and then adding it back. This is