Reputation: 37
I'm struggling to get dashed radius on google maps. Can anyone please help?. I need an output like attached image.
Thanks,
Upvotes: 1
Views: 720
Reputation: 106
With GMSCircle its not possible, you have to draw a polyline based on a circle.
With GMSGeometryOffset you can generate an offset to your location. 360/6 = 60 for less detail an efficiency.
let path = GMSMutablePath()
for i in 0...60 {
let offsetLocation = GMSGeometryOffset(location.coordinate, circleRadius, CLLocationDirection(i*6))
path.add(offsetLocation)
}
let length: [NSNumber] = [10, 10]
let circle = GMSPolyline(path: path)
let styles = [GMSStrokeStyle.solidColor(.clear), GMSStrokeStyle.solidColor(.red)]
circle.spans = GMSStyleSpans(circle.path!, styles, length, GMSLengthKind.rhumb)
circle.strokeWidth = 1.0
circle.map = mapView
Upvotes: 0
Reputation: 133380
Directly on circle is not possible
You could draw a polyline based on circle
var myCicle = new google.maps.Polyline({
path: drawCircle(new google.maps.LatLng( 46.0,11.0), 50, 1),
strokeOpacity: 0,
icons: [{
icon: lineSymbol,
offset: '0',
repeat: '15px'
}],
strokeWeight: 1,
fillColor: "#FFFF00",
fillOpacity: 0.15,
map:map
});
Upvotes: 1