-
Notifications
You must be signed in to change notification settings - Fork 7
/
KMLViewController.cs
33 lines (28 loc) · 1.04 KB
/
KMLViewController.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using CoreGraphics;
using Foundation;
using Google.Maps;
using Google.Maps.Utils;
using UIKit;
namespace Sample.iOS
{
public class KMLViewController : UIViewController
{
private MapView mapView;
private GMUGeometryRenderer renderer;
private GMUKMLParser kmlParser;
public override void LoadView()
{
var camera = CameraPosition.FromCamera(latitude: 37.4220, longitude: -122.0841, 17);
mapView = MapView.FromCamera(frame: CGRect.Empty, camera: camera);
this.View = mapView;
var path = NSBundle.PathForResourceAbsolute("KML_Sample", "kml", NibBundle.BundlePath);
var url = NSUrl.CreateFileUrl(path, null);
kmlParser = new GMUKMLParser(url);
kmlParser.Parse();
renderer = new GMUGeometryRenderer(map: mapView,
geometries: kmlParser.Placemarks,
styles: kmlParser.Styles);
renderer.Render();
}
}
}