polyline

How to get screen XY from Google maps (V3) LatLng?

大憨熊 提交于 2019-12-07 11:41:37
问题 I have polyline in my map. I want to know the pixel (screen) xy-coordinates, when user clicks the polyline. Click event only returns the LatLng object, so does anyone have a clue how to get the pixel coordinates from latLng? I would appreciate very much if someone could help me! 回答1: If you have the LatLng object, you can use the google map projection object to transform it into tile coordinates and then into pixel coordinates: For the docs on the projection class: https://developers.google

Draw a line between two markers map-box react-native?

故事扮演 提交于 2019-12-07 06:27:08
问题 I was able to achieve creating a marker (annotation) on the map using the below code in react-native . import React, { Component } from 'react'; import { Platform, StyleSheet, Text, View } from 'react-native'; import MapboxGL from '@mapbox/react-native-mapbox-gl'; import Mapbox from '@mapbox/react-native-mapbox-gl'; const columbusCircleCoordinates = [ -73.98197650909422, 40.768793007758816 ]; Mapbox.setAccessToken('your access key'); export default class App extends Component {

Animate symbol on multiple geodesic polylines

谁都会走 提交于 2019-12-06 13:24:59
问题 I want to animate symbols though multiple geodesic polylines...i tired to do this in a for loop. the lines get drawn but the circle (symbol) does not animate..it just stays at the starting point here is my code. var poly; var geodesic; var map; var clickcount = 0; function initialize() { var styles = [{ featureType: "landscape", stylers: [{ color: "#000514"}] }, { featureType: "administrative.country", stylers: [{ weight: 0.1 }, { color: "#009acd"}] }, { featureType: "water", stylers: [{

How to put Google Map labels on top?

坚强是说给别人听的谎言 提交于 2019-12-06 08:49:00
I am working with polylines in google map. Basically i am trying to draw a line on several roads using polyline. Now those polylines are blocking(on top) road labels. I have changed the opacity level for better viewing but i really want Google map labels on top. I have studied styling maps, but i havent found any suitable solutions. Is there a way to do it? Thanks in advance. The tiles(which contain the ground, label, streets etc. ) are delivered as single images, not as layers, so there is no way to put anything between particular features that are shown in the tiles. But there may be

Draw polyline on PictureBox

こ雲淡風輕ζ 提交于 2019-12-06 07:33:32
问题 I want to draw polyline (a continuous line composed of one or more line segments) on PictureBox . In this we can create multiple lines by specifying the endpoints of each segment as well as calculate distance of each segment that is distance of each line. 回答1: If you want to do this on a picturebox, the easiest thing is to inherit your own control from a PictureBox and provide the functionality to add endpoints when you mouse down over the picturebox. You then store the position of the mouse

How to distinguish two MKPolyline's in viewForOverlay:

这一生的挚爱 提交于 2019-12-06 07:12:29
问题 I am loading multiple MKPolylines as overlays onto an MKMapView . I would like to be able to distinguish these some how so change things like color, line width, etc. But, when viewForOverlay: gets called, it sees all my MKPolylines the same, which doesn't allow me to change any of them. - (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id <MKOverlay>)overlay { if ([overlay isKindOfClass:[MKPolyline class]]) { MKPolylineView *aView = [[[MKPolylineView alloc] initWithPolyline:

R - Calculate distance between two points along a polyline

狂风中的少年 提交于 2019-12-05 21:27:02
In R - I have imported a polyline shapefile that is not straight (represents a winding interstate highway) into the environment. I have read a .csv file that contains points (latitude/longitude in decimal degrees) into the environment. All of those points lie along the polyline. If I take two random points I can calculate the "as the crow flies" distance between them using great circle distance calculation. But what is needed is distance traveled along the polyline. See reference image: https://i.stack.imgur.com/zhorb.png Is anyone aware of an R package that can calculate the distance between

Google Maps Android api v2 polyline length

懵懂的女人 提交于 2019-12-05 21:14:36
I'm trying to find the android maps api v2 method that will determine the length of the polyline that I am creating while I am moving. I would put it inside onLocationChanged() for continual updates. Anyone know what the method is and what units the the maps api will display the length? Polyline line = map.addPolyline(new PolylineOptions()); public void onLocationChanged(Location location) { line.add(new LatLng(location.getLatitude(), location.getLongitude()) .width(5) .color(Color.RED)); } you can use Location.distanceBetween on your last location to your current location. If you want a total

How to get screen XY from Google maps (V3) LatLng?

瘦欲@ 提交于 2019-12-05 17:21:58
I have polyline in my map. I want to know the pixel (screen) xy-coordinates, when user clicks the polyline. Click event only returns the LatLng object, so does anyone have a clue how to get the pixel coordinates from latLng? I would appreciate very much if someone could help me! If you have the LatLng object, you can use the google map projection object to transform it into tile coordinates and then into pixel coordinates: For the docs on the projection class: https://developers.google.com/maps/documentation/javascript/reference#Projection Google's example explaining how to transform a LatLng

google maps api v3: add point on polyline between two existing points on click polyline event

北战南征 提交于 2019-12-05 17:18:29
How can I add point on a polyline between two existing points on a click polyline event? Thank you! If you are just talking about a Polyline with only 2 points, you could use the center of a LatLngBounds containing the Polyline . Google maps api v3 doesn't implement the Polyline.getBounds() function, though. So you can extend the Polyline class to include a getBounds function: google.maps.Polyline.prototype.getBounds = function() { var bounds = new google.maps.LatLngBounds(); this.getPath().forEach(function(e) { bounds.extend(e); }); return bounds; }; Polyline.getBounds() on a line with only 2