i am using this project to generate my heatmap:
https://github.com/dataminr/DTMHeatmap
I integrated the code as stated in:
https://github.com/dataminr/DTMHeatmap/issues/1
from @johndpope:
https://github.com/johndpope/TranSafe
First, it is compiled successfully, but when i use the "readData" like this:
readData([[52.517138, 13.401489], [52.517137, 13.401488], [52.517136, 13.401487]])
i get the
Thread 1: EXC_BAD_ACCESS(code=2, address=blabla) error
here is the method:
func readData(_ array: [[Double]]){
self.heatmap = DTMHeatmap()
var dict = Dictionary<NSObject, AnyObject>();
for entry in array{
let coordinate = CLLocationCoordinate2D(latitude: entry[1], longitude: entry[0]);
let mapPoint = MKMapPointForCoordinate(coordinate)
let type = NSValue(mkCoordinate: coordinate).objCType // <- THIS IS IT
let value = NSValue(bytes: Unmanaged.passUnretained(mapPoint as AnyObject).toOpaque(), objCType: type);
dict[value] = 1 as AnyObject?;
}
self.heatmap.setData(dict as [AnyHashable: Any]);
self.mapView.add(self.heatmap)
}
func MKMapPointForCoordinate(_ coordinate: CLLocationCoordinate2D) -> MKMapPoint {
return MKMapPointForCoordinate(coordinate);
}
// etc ...
I have really no idea what i have done wrong, anybody could help me with this issue?