Comments (9)
@geisterfurz007 Thanks, well spottet. I wish it made a difference. I tried all combinations with await only, then() only, both together. But the layer is never found.
UPDATE: It's the geojsonHeatmap.existsSync()
that was causing the issue!
from mapbox-maps-flutter.
This can already be achieved with interpolate:
{
"circle-radius": [
"interpolate", ["linear"], ["zoom"],
// zoom is 5 (or less) -> circle radius will be 1px
5, 1,
// zoom is 10 (or greater) -> circle radius will be 5px
10, 5
]
}
from mapbox-maps-flutter.
Hi, thanks for your reply.
Yeah, we used to use interpolate for that.
I just couldn't find mention of any layer styles in the readme or demo app.
Now searching for interpolate in the project I see it gets used with layer styles once. A bit of hay in a needle stack.
Thanks for this! Perhaps it can be mentioned in the readme?
I think most devs new to Mapbox wouldn't be aware of layer styles or even think to search for them in the demo app.
from mapbox-maps-flutter.
@irjayjay hey, there's not a lot of docs about expressions usage at the moment (though seems you've found the animated route page that uses interpolate
).
We'll definitely work on adding more!
from mapbox-maps-flutter.
Hi there. I think for expression usage a simple link to the mapbox docs would be fine.
I was referring more to mentioning in the readme that you can create layers and layer styles the traditional way.
But I see it's already there. I don't know how I missed that before.
Once again, thanks for all the great work!
from mapbox-maps-flutter.
Can this "traditional way" also be used for the HeatmapLayer?
With mapboxMap.style.setStyleLayerProperty
I only get: Unhandled Exception: PlatformException(StyleError(rawValue: "Layer heatmap is not in style"), null, null, null)
from mapbox-maps-flutter.
@demux79 Make sure the layer is added to the styles before you try to set the style layer property; for that, make sure to await
the call to addLayer
.
from mapbox-maps-flutter.
@geisterfurz007 Hi, thanks for getting back to me. Unfortunately, I am already awaiting everything but still get the error. Do you have an idea? Also the styleSourceExists
in line 6 is never true.
void _onStyleLoaded(StyleLoadedEventData styleLoadedEventData) async {
await _addLayerAndSource();
}
Future<void> _addLayerAndSource() async {
await mapboxMap?.style.styleSourceExists("source").then((exists) async {
if (!exists) {
// TODO: Is never called for unknown reasons
// If source exists - just update it
// final source = await mapboxMap?.style.getSource("source");
// (source as GeoJsonSource).updateGeoJSON(json.encode(geojsonHeatmap));
// } else {
await mapboxMap?.style.addSource(GeoJsonSource(
id: "source", data: geojsonHeatmap.readAsStringSync()));
}
});
mapboxMap?.style.styleLayerExists("heatmap").then((exists) async {
if (!exists && geojsonHeatmap.existsSync()) {
await mapboxMap?.style.addLayer(HeatmapLayer(
id: 'heatmap',
sourceId: 'source',
minZoom: 4.0,
heatmapIntensity: 0.1,
heatmapOpacity: 0.5,
heatmapRadius: 30,
heatmapWeight: 1.0,
));
}
});
await mapboxMap?.style.setStyleLayerProperty('heatmap', 'heatmap-radius', 40);
}
from mapbox-maps-flutter.
@demux79 There is one await
missing at the second larger block in front of mapboxMap?.style.styleLayerExists
.
from mapbox-maps-flutter.
Related Issues (20)
- 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
- Update source property bounds HOT 1
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.