how to draw path between two location in using map box? - flutter

I want to draw path between two points. I am using flutter_map 0.10.1+1 package to include map.
I am getting points between two locations using map box api. When I draw Polyline using that points it draws straight line, instead of drawing line on road.
For example I am getting following points when I try to get points between two location:
LatLng(latitude:21.202751, longitude:72.838807)
LatLng(latitude:21.198725, longitude:72.836119)
LatLng(latitude:21.196459, longitude:72.83742)
LatLng(latitude:21.195418, longitude:72.836605)
LatLng(latitude:21.195194, longitude:72.836577)
LatLng(latitude:21.189253, longitude:72.832431)
LatLng(latitude:21.186454, longitude:72.829726)
checkout following image how I am able to draw line.

You need to specify the polylines mode type in the package you use.
GoogleMapPolyline googleMapPolyline =
new GoogleMapPolyline(apiKey: "yourkeyhere");
googleMapPolyline.getCoordinatesWithLocation(
origin: LatLng(40.6782, -73.9442),
destination: LatLng(40.6944, -73.9212),
mode: RouteMode.driving);--->You need to set the mode type

Related

Setting the CRS for non-geographical svg map

I'm trying to show a custom non-geographical map with CRS.simple as explained here:
In a CRS.Simple, one horizontal map unit is mapped to one horizontal
pixel, and idem with vertical
However, I wish to use an SVG vector image as an overlay, but I don't get how the map unit is decided in this case, since the vector images don't really have a resolution?
Also, how could set the CRS origin's location to a specific point?
Thanks for helping

polygon label displying duplicate in mapbox studio style editor

I have uploaded polygon shape zip file in mapbox tileset and created layer name as polygon_label but layer labels are showing duplicate inside polygon area.
So there is any way to centroid the polygon geometry or restrict to display duplicate label.
How to get label centroid of the polygon and remove duplication of the label from polygon area?
You need to create point geometries and use that as your source.
I have the same issue with a shapefile with land sections I imported. To get the outline of the land sections I added a fill type layer since the tileset contains polygon features. Then I add another layer of type symbol to be able to show the section address text field from the tileset features. I set the placement as "Point". But, the text field shows multiple places inside the polygons.
The only solution I have found is to make the labels appear along the boundries of the polygons by setting the placement as "Line". This still shows multiple labels. But, it is a bit more friendly for the user.

Set Zoom Level of Map to particular Zip Code

I am using MapQuest JS batch API to plot multiple address on the map. I am able to pass multiple address & plot pins accordingly. I following example on below link. The map may have multiple pins plotted all over USA, I want to set the zoom level of the map, conditionally to particular zip code.
https://developer.mapquest.com/documentation/samples/geocoding/v1/batch/
Currently the zoom level is set to best Fit
var options = {
elt: "map",
zoom: 10,
mtype: 'map'
};
var map = new MQA.TileMap(options);
map.bestFit();
I am expecting to set zoom level to specific zip code based on certain criteria.
Updates: 01/20
On the below link, there is a option to set initial center of the map to particular latitude/longitude. but this did not work for me
https://developer.mapquest.com/docs/api-reference/javascript-api/classes/MQA.TileMap.html
Option:
[latLng] MQA.LatLng optional
the initial map center as a MQA.LatLng Default: {lat: 38.134557, lng: -98.4375}
Hopefully, both the map center and zip code questions have been addressed in the MapQuest developer forum post.
https://developer.mapquest.com/forum/how-set-zoom-level-particular-zip-code

Leaflet: How to deal with overlapping lines?

How can I deal with overlapping lines in the Leaflet map library?
I download geoJSON from the server sid and draw it right onto the map. If there are two identical entries, Leaflet draws them twice. This could be fixed by finding exact duplicated on the server side.
That however doesn't work for different datasets sharing some of the same space. As a result parts of both are drawn onto the same spot.
It appears that the lines are being rendered with the default Leaflet Polyline opacity of 0.5. If you were instantiating the Polylines yourself in code, you could override the opacity to make the lines opaque in this manner:
var myPolyLine = new L.Polyline( myPoints, { opacity: 1 } );
The line that would appear on top would then be the line that you added to the map last (one or the other is going to be on top, unless you make them both opaque and the same color). But this may be moot if you are loading in geoJSON directly and don't have control over how Leaflet renders it.

Using custom point markers in Matlab Mapping Toolbox

I'm trying to find out if it's possible to create custom point markers (from some image files) in Matlab with Mapping Toolbox.
So far, I didn't find anything about this in their documentation. Online searches only yielded:
No. The marker shapes are hard-coded and you cannot add new ones. If you want a custom
marker, then at each point you want the marker, you will have to use line() or
equivalent to draw the marker or image() or equivalent to draw in an image.
(Source: http://groups.google.com/group/comp.soft-sys.matlab/browse_thread/thread/4fe4e31f191f7080)
PS: I also cross-posted this to https://gis.stackexchange.com/questions/3413/using-custom-point-markers-in-matlab-mapping-toolbox
How about this? Image Markers: Plots an image and superimposes a binary image as a colored marker.