This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use runtime styling to animate a repeating pulsing animation on an MGLMapView | |
class MyAnimationDemoClass { | |
var animationTimer: Timer? | |
var lineLayers = [MGLLineStyleLayer]() // Array to hold the Line style layers we created so they can be reused to repeat the animation | |
// This function will animate a set of line segments and return the duration of the entire animation. | |
// The duration can be used to set up a repeating timer to trigger the animation again if you want it to loop | |
private func animateByStep(style: MGLStyle, shapes: [LineString]) -> TimeInterval { | |
guard shapes.count > 0 else { return 0 } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private func applyOpacity(style: MGLStyle) { | |
// NSExpression *iconOpacityStyle = | |
// [NSExpression expressionWithFormat:@"MGL_MATCH(%@, %@, %f, %f)", selectedAttributeName, selectedAttributeValue, | |
// selectedIconOpacity, deselectedIconOpacity]; | |
// works for the Nav V5 style to fade away all the road shields that aren't for I-280 | |
if let symbolLayer = style.layer(withIdentifier: "road-number-shield-navigation") as? MGLSymbolStyleLayer { | |
let selectedAttributeName = "ref" | |
let selectedAttributeValue = "280" | |
let selectedIconOpacity = NSExpression(forConstantValue: NSNumber(1.0)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Go to My Maps in google maps | |
In one of your Maps, add a turn by turn directions step for the route you want | |
Right click the top level My Maps window that contains the steps | |
Select "Export as KML" | |
Check the KML box and save the file | |
Open downloaded file in BBEdit or other powerful text editor | |
Copy out only the portion of the file that is the long list of coordinates and place it in it's own file without the rest of the KML. | |
In BBEdit, use the find regular expression: (.*?),(.*?),0 and the replace regular expression: <wpt lat="\2" lon="\1"/> to transform the KML coordinate representation into the GPX waypoint format needed by Xcode | |
Prepend the GPX JSON tags in the following 2 lines: | |
<?xml version="1.0"?> |