-
Notifications
You must be signed in to change notification settings - Fork 502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Having Lines + GeoJson, lines are often broken #963
Comments
Can you post a screenshot / more details how this goes wrong? This is quite surprising to me as I use multiple line layers all the time an have yet to see an issue. |
I am showing 4 lines of different color and often only one line is displayed. I first noticed it on release build on Android, everything seemed fine in debug. on iOS the issue was also present in debug. |
What is strange that the annotation manager only wraps the geojson source /vector layer api. The only thing i could think of is some overlap issue. Any vector layers you add later gets added over the annotations. |
@felix-ht I did some more debugging. Only last call to I don't see this happening on Android, both lines update |
can you post the code causing the issue? |
I will try to reproduce on the sample app somehow. |
can you try putting some delay between those call to make sure that it's not a race condition? |
can you check this branch? #970 |
@felix-ht still somewhat the same. I can see both lines updating, but one is blinking strangely all the time |
does it keep blinking afterwards? does the update go through? |
You can see a dark blue line on the left, above orange – this one is drawn wrong for some reason. RPReplay_Final1648217214.MP4 |
you can try adding some debug code to setFeature in swift as well flutter - with this you should be able to see what goes on. also set feature does not handle errors at all - so it might be a good idea to add some code there as well. |
diff --git a/ios/Classes/MapboxMapController.swift b/ios/Classes/MapboxMapController.swift
index 6aff92a..b866948 100644
--- a/ios/Classes/MapboxMapController.swift
+++ b/ios/Classes/MapboxMapController.swift
@@ -1312,6 +1312,7 @@ class MapboxMapController: NSObject, FlutterPlatformView, MGLMapViewDelegate, Ma
}
func setFeature(sourceId: String, geojsonFeature: String) {
+ print("setFeature")
do {
let newShape = try MGLShape(
data: geojsonFeature.data(using: .utf8)!,
@@ -1321,6 +1322,7 @@ class MapboxMapController: NSObject, FlutterPlatformView, MGLMapViewDelegate, Ma
let shape = addedShapesByLayer[sourceId] as? MGLShapeCollectionFeature,
let feature = newShape as? MGLShape & MGLFeature
{
+ print(feature)
if let index = shape.shapes
.firstIndex(where: {
if let id = $0.identifier as? String,
@@ -1335,12 +1337,16 @@ class MapboxMapController: NSObject, FlutterPlatformView, MGLMapViewDelegate, Ma
{
var shapes = shape.shapes
shapes[index] = feature
-
+ print(index)
source.shape = MGLShapeCollectionFeature(shapes: shapes)
}
}
- } catch {}
+ } catch {
+ print("setFeature error")
+ }
+ print("setFeature done")
+
}
/*
|
@felix-ht I made a PR that seems to fix the issue for me. I will remove the logs now quickly. |
I have 2 different layers, one for GeoJson, another for Lines with a LineController.
Lines often do not display correctly in that case.
The text was updated successfully, but these errors were encountered: