mapbox / mapbox-maps-flutter

Interactive, thoroughly customizable maps for Flutter powered by Mapbox Maps SDK
https://www.mapbox.com/mobile-maps-sdk
Other
279 stars 108 forks source link

Polyline not rendered correctly #675

Open noforeignland opened 2 weeks ago

noforeignland commented 2 weeks ago

When displaying a complex polyline it only renders correctly at higher zoom levels. At lower zoom levels, sections of the line fail to render.

Problem occurs using build 2.2.1. on physical iPhone 14 Pro, and Samsung S22. Not tested on other devices.

https://github.com/user-attachments/assets/7f638ec5-17b5-4ccf-b1ec-084552e38953

evil159 commented 2 weeks ago

@noforeignland Could you share your layer&source setup?

noforeignland commented 1 week ago

@noforeignland Could you share your layer&source setup?

Yes here you go:

_recordTrackSource = GeoJsonSource(
  id: recordTrackSourceId,
  data: json.encode(GeoJsonUtils.emptyFeatureCollection),
);
await mapboxMap.style.addSource(_recordTrackSource);

await mapboxMap.style.addLayer(LineLayer(
  id: recordTrackLinesLayerId,
  sourceId: recordTrackSourceId,
  filter: ['==', '\$type', 'LineString'],
  lineColor: Colors.red.value,
  lineWidth: 2.5,
));

await mapboxMap.style.addLayer(SymbolLayer(
  id: recordTrackArrowsLayerId,
  sourceId: recordTrackSourceId,
  filter: ['==', '\$type', 'LineString'],
  symbolPlacement: SymbolPlacement.LINE,
  symbolSpacing: 100,
  iconImage: 'nfl_arrow',
  iconSize: 0.5,
));

await mapboxMap.style.addLayer(CircleLayer(
  id: recordTrackPuckLayerId,
  sourceId: recordTrackSourceId,
  filter: ['==', 'terminal', true],
  circleRadius: 5,
  circleColor: Colors.white.value,
  circleStrokeColor: Colors.red.value,
  circleStrokeWidth: 3,
  minZoom: 0,
));
noforeignland commented 1 week ago

@noforeignland Could you share your layer&source setup?

Yes here you go:

_recordTrackSource = GeoJsonSource(
  id: recordTrackSourceId,
  data: json.encode(GeoJsonUtils.emptyFeatureCollection),
);
await mapboxMap.style.addSource(_recordTrackSource);

await mapboxMap.style.addLayer(LineLayer(
  id: recordTrackLinesLayerId,
  sourceId: recordTrackSourceId,
  filter: ['==', '\$type', 'LineString'],
  lineColor: Colors.red.value,
  lineWidth: 2.5,
));

await mapboxMap.style.addLayer(SymbolLayer(
  id: recordTrackArrowsLayerId,
  sourceId: recordTrackSourceId,
  filter: ['==', '\$type', 'LineString'],
  symbolPlacement: SymbolPlacement.LINE,
  symbolSpacing: 100,
  iconImage: 'nfl_arrow',
  iconSize: 0.5,
));

await mapboxMap.style.addLayer(CircleLayer(
  id: recordTrackPuckLayerId,
  sourceId: recordTrackSourceId,
  filter: ['==', 'terminal', true],
  circleRadius: 5,
  circleColor: Colors.white.value,
  circleStrokeColor: Colors.red.value,
  circleStrokeWidth: 3,
  minZoom: 0,
));