Does anyone have any example code of using Bing maps as the provider with React-Leaflet? I looked through the docs but it only use openstreetmap. I don't see an example of adding any provider.
I solved my own problem kinda. I could not use React-Leaflet or at least not version 3 so I did it with React, Leaflet, and leaflet-bing-layer. For my needs I also needed to make an api call to render ferry pins. Rather than type it all in here I will include a link to a gist.
Related
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
I want to use OSM in flutter .but I cannot add it to flutter and i want to use any free maps like this.
I don't wanna pay for APIs .what should I do?
Is there any way to add OSM To flutter.
it takes couples of day and I can't add any map to my app!
You should use the flutter_map package, like quoci said in the comments.
It allows you to view maps from any source that gives a URL as an access method. There are plenty of setup instructions and examples on the package's readme page for you to get started.
You can even use Google Maps' Static Tiles API URL (which, don't quote me on this part, I think is legal to use without payment).
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
I am using mapbox and leaflet and leaflet plugin.
I have a very simple question. I'd like to have the option to avoid tolls/bridges/etc by passing the specific option. Is this possible ? I've seen that for mapbox swift , it's possible, but i don't see anything mapbox api has something like this for Directions/Optimization API.
Any idea on how I can achieve this?
You can pass exclude=toll to the API call to avoid tolls.
Documentation
It is more theoretical question, rather than some problem.
I'm planning to develop some wrapper for leaflet (encapsulate work with leaflet for other developer teams with some API in/out), and I'm wondering if to use react-leaflet or to use native leaflet library.
There is very long list of available plugins for leaflet, and as far as i see only +-10 of them implemented for react-leaflet.
From your experience, does all the original leaflet plugins works fine with react-leaflet? How often do you encountered with problem and which one are not working at all?
It should be possible to create a custom component for any react-leaflet extension.