Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Strange lines after zoom-in LineLayer in Android #16640

Open

Description

@kingfisherphuoc

Platform: Android
Mapbox SDK version: 9.7.1
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:9.7.1'

Steps to trigger behavior

  1. Load map view async + map style

  2. Add a list of latlngs to map as Layer and Source as below:

        val features = mutableListOf<Feature>()
        var coordinateList = ArrayList<Point>()
        var index = 0
        for (item in locations) {
            coordinateList.add(
                Point.fromLngLat(
                    item.longitude,
                    item.latitude
                )
            )
            
            val properties = JsonObject()
            properties.addProperty("index", index)
            val feature =
                Feature.fromGeometry(
                    Point.fromLngLat(item.longitude, item.latitude),
                    properties
                )
            features.add(feature)
            index += 1
        }
        mapStyle!!.addSource(
            GeoJsonSource(
                "route-line-source", FeatureCollection.fromFeatures(
                    arrayOf(
                        Feature.fromGeometry(
                            MultiPoint.fromLngLats(coordinateList)
                        )
                    )
                )
            )
        )
    
        mapStyle!!.addLayer(
            LineLayer("route-line-layer", "route-line-source").withProperties(
                PropertyFactory.lineCap(Property.LINE_CAP_ROUND),
                PropertyFactory.lineJoin(Property.LINE_JOIN_ROUND),
                PropertyFactory.lineWidth(3f),
                PropertyFactory.lineColor(Color.RED)
            )
        )
    
        val fromFeatures = FeatureCollection.fromFeatures(features)
        mapStyle!!.addSource(GeoJsonSource("index-source", fromFeatures))
        val symbolLayer = SymbolLayer("index-layer", "index-source")
        symbolLayer.setProperties(
            PropertyFactory.textField(Expression.toString(Expression.get("index"))),
            PropertyFactory.textSize(MapFragment.CLUSTER_RADIUS / 2f),
            PropertyFactory.textColor(Color.RED),
            PropertyFactory.textAllowOverlap(true)
        )
        mapStyle!!.addLayer(symbolLayer)
    

Expected behavior

The line should always follow and be beneath the index numbers.

Actual behavior

It worked well if the camera zoom out < 13. However, when I tried to zoom in the map, I saw a lot of strange lines crossing near the numbers as in the image below. If I zoomed out, the strange lines disappeared.

It's very easy to reproduce. You can test it with the attached locations.json: locations.json.zip

Screenshot_20220420_001941

Activity

  1. changed the title [-]Strange lines after zoom-in LineLayer[/-] [+]Strange lines after zoom-in LineLayer in Android[/+] on Apr 21, 2022
  2. kingfisherphuoc commented on Apr 21, 2022

    @kingfisherphuoc
    Author

    @tobrun do you have any thought on this?

  3. kingfisherphuoc commented on May 11, 2022

    @kingfisherphuoc
    Author

    any update for this issue?

  4. BlowJohan commented on Jul 28, 2022

    @BlowJohan

    Same problem, but with polygons. This lines is everywhere! Starts with 12-13 zoom level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions