How do i fix crossing polylines on google maps flutter - flutter

I'm using the official Google Maps Flutter plugin & the google directions API to show maps and draw polylines and it works perfectly fine until I start drawing complex polylines.
The problem is polylines are not following the correct lanes on some specific roads.
Here is an example
Is there a way I can make that a single line?
I have tried removing duplicate PointLatLan from the list of polylines I used, but it got worse.
If you have an idea on how to fix this || you need more information regarding this question. Your help is appreciated.
Thanks

Related

How to build a route from an array of coordinates in "flutter" using "Mapbox"

I am new to mobile development and have set myself the goal of creating an application that will follow me, the scenario is as follows, I launch the application, press a button and after that the longitude and latitude coordinates of my current location are sent to the server every 5 seconds, after about an hour- two walks around the city in the database there is an array of coordinates.
Next, in the application that I create on “flutter”, a map of my journey should be displayed. From the forums, I understood that "mapbox" is ideal for visualizing a route with lines between coordinates, but I could not find tutorials on how to do this with an array of coordinates. Please tell me where to learn how to work with this library.
In the official docs, I couldn't figure out what I need to learn. Maybe you know sites with recipes or with ready-made examples of building routes using an array of coordinates? Thank you in advance.
I could not find tutorials on how to do this with an array of coordinates. Please tell me where to learn how to work with this library. In the official docs, I couldn't figure out what I need to learn.

Google Earth Web/Online WMS

I am trying to add a WMS service to Google Earth Web/Online: https://earth.google.com/web
I tried importing a .kml file that works in the desktop version of GE but had no success. I also tried adding a tile overlay, which failed as well. I could not find any recommendations for working with WMS services in the google faq/ help docs or on the web. Has anyone been successful with this?
The WMS I would like to add: http://www.geoportal.rlp.de/mapbender/php/wms.php?layer_id=61675&REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS&withChilds=1
WMS overlays currently work in Google Earth Pro, but they do not work in Earth v9.x (web & mobile apps) at this time.
But in Earth for web, you should be able to add a Tile Layer that loads a set of Google Map Tiles (the same tile format as you would use with the Google Maps Platform / Maps API). You need the URL for the tile layer, with the appropriate $[x], $[y] and $[level] variables (note "level" instead of "z"). You'll also want to add the N/S/E/W tile extent coordinates. And I believe it only supports 256x256 tiles at this time. Let us know how you're trying to add a tile layer, and we can try to debug that.

Mapbox Static API - How to use custom markers in GeoJSON overlay?

The docs say it's possible so I'm obviously missing something. So far I've tested different variations of marker-url and url- in the Mapbox playground with both single point and feature collections (as shown in the examples) but all I'm getting are the generic markers.
Any guidance to point me in the right direction?
https://api.mapbox.com/styles/v1/mapbox/streets-v11/static/geojson({"type":"FeatureCollection","features":[{"type":"Feature","properties":{"url-":"http%253A%252F%252Fwebsite.com%252Ffiles%252Fmarkers%252Fgreenpin.png"},"geometry":{"type":"Point","coordinates":[-122.2599,37.8098]}},{"type":"Feature","properties":{"url-":"http%253A%252F%252Fwebsite.com%252Ffiles%252Fmarkers%252Fgreenpin.png"},"geometry":{"type":"Point","coordinates":[-122.2591,37.8062]}},{"type":"Feature","properties":{"url-":"http%253A%252F%252Fwebsite.com%252Ffiles%252Fmarkers%252Fgreenpin.png"},"geometry":{"type":"Point","coordinates":[-122.2565,37.8063]}}]})/-122.2647,37.8006,12,0/1080x1080#2x?access_token={token}
This is not reflected in the official documentation, but in order to use a custom marker with a geojson overlay, you can rely on the marker-url property for your features.
If you update your request to the API to the following, you should achieve the desired result:
https://api.mapbox.com/styles/v1/mapbox/streets-v11/static/geojson({"type":"FeatureCollection","features":[{"type":"Feature","properties":{"marker-url":"http%253A%252F%252Fwebsite.com%252Ffiles%252Fmarkers%252Fgreenpin.png"},"geometry":{"type":"Point","coordinates":[-122.2599,37.8098]}},{"type":"Feature","properties":{"marker-url":"http%253A%252F%252Fwebsite.com%252Ffiles%252Fmarkers%252Fgreenpin.png"},"geometry":{"type":"Point","coordinates":[-122.2591,37.8062]}},{"type":"Feature","properties":{"marker-url":"http%253A%252F%252Fwebsite.com%252Ffiles%252Fmarkers%252Fgreenpin.png"},"geometry":{"type":"Point","coordinates":[-122.2565,37.8063]}}]})/-122.2647,37.8006,12,0/1080x1080#2x?access_token={token}
Disclaimer: I currently work at Mapbox

How to use leaflet "openstreetmap" with flutter?

I need help to integrate leaflet maps in flutter. The project I'm working on requires showing custom markers, animations, routes and drawings on the map. But I can't find any documentation or tutorials explaining this in flutter.
You can use flutter_map package for that. That's one of two most widely used maps packages (next to google_maps_flutter, which is obviously only for Google Maps).
https://github.com/johnpryan/flutter_map
It features all things that you need AFAIR.
You may check out the below Flutter Maps widget which allows you to render tiles from different services like OpenStreetMaps, Azure Maps, etc.
https://pub.dev/packages/syncfusion_flutter_maps
It has the features you have requested like markers, adding animations, drawing routes on the maps, highlight a region, etc. Check the below links for more details.
https://help.syncfusion.com/flutter/maps/markers
https://help.syncfusion.com/flutter/maps/vector-layers/polyline-layer#adding-polylines

OpenStreetMap Grayscale tiles?

I'm building up experience with web development and my next projects are some web maps. I've looked into Google Maps and Open Street Maps and would like to use OSM for a project as it contains more detailed information of building footprints.
I've tried styling Google Maps which seemed fairly straightforward, but I'm a little lost with OSM. I've got to the point of trying to create my own renders (with TileMill) but this is crashing my system due to the amount of data.
What I essentially need is this (but for the UK);
http://maps.stamen.com/#terrain/12/37.7706/-122.3782
Are there any resources which you can recommend or how easy/ difficult is this to create myself? I think I would need to create the map (with TileMill or similar and then find my own servers to host), or is there an easy way to convert the standard map to Grayscale?
I want to keep it as simple as possible so please any recommendations?
Turning the standard map to grayscale: I might be very late to this but for anyone else running into this question: I found a very easy solution if you're working with HTML and Javascript using OpenLayers and the standard OpenStreetMap-Tile-Layer in color. I took the solution from here: https://openlayers.org/en/latest/examples/semi-transparent-layer.html
I don't know much about web development but this solution worked for me. Upon creating the map, as done in main.js in the example from the link, a class name is defined ('bw')
className: 'bw',
that can be used in index.html to manipulate the style o f it in the part:
<style>
.bw {
filter: grayscale(100%);
}
</style>
My application was altering a pre-built web-map from the qgis2web extension for QGIS. I was able to turn the tile layers from the background map to grayscale so the results would stand out more.
You could use https://github.com/Zverik/leaflet-grayscale to display any tile layer in grayscale. It's a plugin built upon the leaflet map displaying library.