Comments (4)
You can first add the layer with default properties and then use
mapboxMap.style.setStyleLayerProperty('layer_id', 'color', jsonEncode(['get','custom-color']))
from mapbox-maps-flutter.
You can first add the layer with default properties and then use
mapboxMap.style.setStyleLayerProperty('layer_id', 'color', jsonEncode(['get','custom-color']))
Hey, I just tried that and I get this error:
PlatformException (PlatformException(Throwable, java.lang.Throwable: layer doesn't support this property, Cause: null, Stacktrace: java.lang.Throwable: layer doesn't support this property
at com.mapbox.maps.mapbox_maps.StyleController.setStyleLayerProperty$lambda-18(StyleController.kt:212)
at com.mapbox.maps.mapbox_maps.StyleController.$r8$lambda$WKv9Hkp6n6Ramjn-IsD3ANd83Co(Unknown Source:0)
at com.mapbox.maps.mapbox_maps.StyleController$$ExternalSyntheticLambda35.onStyleLoaded(Unknown Source:8)
at com.mapbox.maps.MapboxMap.getStyle(MapboxMap.kt:355)
at com.mapbox.maps.mapbox_maps.StyleController.setStyleLayerProperty(StyleController.kt:208)
at com.mapbox.maps.pigeons.FLTMapInterfaces$StyleManager$-CC.lambda$setup$15(FLTMapInterfaces.java:7200)
at com.mapbox.maps.pigeons.FLTMapInterfaces$StyleManager$$ExternalSyntheticLambda40.onMessage(Unknown Source:2)
at io.flutter.plugin.common.BasicMessageChannel$IncomingMessageHandler.onMessage(BasicMessageChannel.java:217)
at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:250)
at android.app.ActivityThread.main(ActivityThread.java:7806)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)
, null))
This is how I create the layer:
await mapController.style.addSource(GeoJsonSource(id: 'styleSource', data: json.encode(geojson))); // Here geojson is a Map<String, dynamic>
await mapController.style.addLayer(
LineLayer(
id: 'styleLayer',
sourceId: 'styleSource',
lineCap: LineCap.ROUND,
lineWidth: 3,
),
);
await mapController.style.setStyleLayerProperty(
'styleLayer',
'color',
json.encode(['get', 'line-color']),
);
from mapbox-maps-flutter.
Line layer does not have 'color' property, it is 'line-color'.
Check out this: https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#line
from mapbox-maps-flutter.
Oh, okay, that's where the names come from :D Thanks!
from mapbox-maps-flutter.
Related Issues (20)
- Leverage Turf for Geometry in TileRegionLoadOptions HOT 1
- Offline map question HOT 7
- map movement feels heavy
- Raster Source from byte data HOT 1
- `cameraForCoordinatesPadding` does not zoom map to exactly wrap coordinates provided HOT 2
- backdrop filter does not work HOT 1
- 3d Location Puck not showing on the map HOT 15
- [performance] CameraForCoordinateBounds deprecation question
- annotation and popoup
- Mapbox cannot render without VPN
- Offline Map Functionality Issue HOT 3
- Unresolved reference: ViewTreeLifecycleOwner HOT 11
- Map loading issues on low network conditions
- Requests GPS permission on load HOT 3
- mapbox maps not showing the map on tablet but showing on emulator android HOT 8
- requestMyLocationLatLng
- Release 2.1.0 and 2.2.0-rc.1 runs into Error on Android Devices. iOS compilation is OK HOT 2
- Error while debug my app after install and configure the mapbox-maps-flutter HOT 3
- source error for point annotations HOT 1
- `onPolygonAnnotationClick` is triggered 6 times on iOS HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mapbox-maps-flutter.