Comments (4)
@heraknos
Thank you for trying out our library. It's still in development and we only covers the case we need internally, not all cases covered by Mapbox.
Feel free to fork it, customize it and create a pull request.
Cheers.
from mapbox-xamarin-forms.
Hi @heraknos,
You can use PolylineAnnotation to draw polyline.
Firstly, initialize the annotations list of the mapview (which is recommended to be an observable collection):
mapview.Annotations = new ObservableCollection<Annotation>();
(We didn't create any AddAnnotation function since we found that using collections made binding easier).
Then create a polyline with predefined coordinates, or an observable collection of coordinates if you want to update them later:
var myPolyline = new PolylineAnnotation()
{
Id = "my_polyline",
Coordinates = new ObservableCollection<Position>(new Position[] { startingPoint })
};
If you already has a PolylineFeature, you may use it instead of this newly created annotation.
Finally, add it into the annotations list.
If you want to styling the line, you need to create a new ShapeSource and a LineLayer (no need to add the line into the annotations list):
var source = new ShapeSource("polyline_source", myPolyline);
mapView.MapStyle.CustomSources = new ObservableCollection<ShapeSource>(
new ShapeSource[] { source }
) ;
var layer = new LineLayer("polyline_layer", "polyline_source")
{
LineWidth = 2.0
};
mapview.MapStyle.CustomLayers = new ObservableCollection<Layer>(new Layer[] { layer });
Hope this'll help :)
from mapbox-xamarin-forms.
I will check that, thx.
Any other features for markers ?
from mapbox-xamarin-forms.
There are also PointAnnotation, MultiPolylineAnnotation and CircleLayer, which work similar to the example above. You can use CanShowCalloutChecker
function to set whether callout view should be shown when user taps on a annotation (input is the annotation's Id). For example:
mapview.CanShowCalloutChecker = (annotationId) =>
{
if (annotationId != null
&& annotationId.StartsWith("my_prefix", StringComparison.CurrentCulture))
{
return true;
}
return false;
};
There's no function to customize the callout view yet though.
from mapbox-xamarin-forms.
Related Issues (20)
- user location issue HOT 1
- Center offset
- Implement Get Cluster Leaves
- Need to show marker with Label/Text
- Outdated
- Android: app freeze + fix
- Navigation
- Symbol Annotations not getting refreshed in run time
- Release mode iOS fails
- Can't Run Xamarin.Forms App on Android HOT 12
- map property global
- App Crash on Android 11 HOT 5
- Demo project from repo doesn't compile HOT 4
- App Crash on Android 11 HOT 2
- Mapbox Xamarin.Forms black map on Android HOT 1
- MapView.ZoomLevel does not change on iOS.
- MapBox pre-v10 is unsupported from April 4th 2023 HOT 3
- Showing CircleAnnotations on map
- Unable to activate instance of type Naxam.Controls.Mapbox.Platform.Droid.MapViewRenderer from native handle HOT 2
- Map Bounds Are Not Properly Set To Query Map Features HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mapbox-xamarin-forms.