I'm in the process of developing my first native iOS app using Xamarin, I'm using MapKit and MKPolyline to outline a route along the coast of Ireland, however, the way I'm doing it is taking way too long to render approx 6.5mins when I launch the application in my simulator. I realize this is down to the fact that I am using approx 64,000 coordinates to trace out the route, I extracted these points from a gpx file so I realise there is probably a lot of unnecessary points. The code I've been using to generate the poly line is as follows
MKPolyline CoastalOverlay = MKPolyline.FromCoordinates(
new CLLocationCoordinate2D[] {
new CLLocationCoordinate2D(51.704497, -8.520959),
/*
/* More CoOrdinates here
*/
});
map.AddOverlay(CoastalOverlay);
public override MKOverlayView GetViewForOverlay(MKMapView mapView,IMKOverlay overlay)
{
// return a view for the polyline
MKPolyline polyline = overlay as MKPolyline;
MKPolylineView polylineView = new MKPolylineView(polyline);
polylineView.StrokeColor = UIColor.Purple;
return polylineView;
}
I'm self-teaching myself so I've been sticking to the Xamarin demos and tutorials and I'm wondering is there a more efficient and faster way of doing this? I've tried researching some minimisation algorithms but I haven't found any that seem to work for what I'm trying to do. Any help would be greatly appreciated :)
The code I have developed at the moment is working and doing what I'd like it to the problem just is it's very slow