Open zhaoMing8 opened 4 months ago
You could try this:
ByteData byteData = await rootBundle.load('assets/map_icons/home.png');
Uint8List image = byteData.buffer.asUint8List();
final parsedImage = await decodeImageFromList(image);
final mbxImage = MbxImage(data: image, height: parsedImage.height, width: parsedImage.width);
await mapController.style.addStyleImage(
assetName,
1,
mbxImage,
false,
[],
[],
null,
);
You could try this:
ByteData byteData = await rootBundle.load('assets/map_icons/home.png'); Uint8List image = byteData.buffer.asUint8List(); final parsedImage = await decodeImageFromList(image); final mbxImage = MbxImage(data: image, height: parsedImage.height, width: parsedImage.width); await mapController.style.addStyleImage( assetName, 1, mbxImage, false, [], [], null, );
Oh! Thanks! That worked for me.
You could try this:
ByteData byteData = await rootBundle.load('assets/map_icons/home.png'); Uint8List image = byteData.buffer.asUint8List(); final parsedImage = await decodeImageFromList(image); final mbxImage = MbxImage(data: image, height: parsedImage.height, width: parsedImage.width); await mapController.style.addStyleImage( assetName, 1, mbxImage, false, [], [], null, );
Oh! Thanks! That worked for me. but, i have a question, Why have to use the parsedImage.height and parsedImage.width, Why can`t to use Custom definition hieght or width .
Sorry, I am not able to explain you that as I am not a Flutter expert myself. But the same error occurred on my side some days ago and I found that solution/workaround somewhere in StackOverflow, so I was able to continue my work at least.
Sorry, I am not able to explain you that as I am not a Flutter expert myself. But the same error occurred on my side some days ago and I found that solution/workaround somewhere in StackOverflow, so I was able to continue my work at least.
ohh, A strange question. thank you very much for help me to continue my work!
@zhaoMing8 Now that you got it working, I need to ask you a question... :) Do the images appear sharp in your app?
On my side, the SymbolLayer icons look very blurry on Android and iOS (device and simulator) and I have no idea why. I also tried that custom-icon.png asset from the example-app but that does not look sharp as well. How is your experience?
@zhaoMing8 Now that you got it working, I need to ask you a question... :) Do the images appear sharp in your app?
On my side, the SymbolLayer icons look very blurry on Android and iOS (device and simulator) and I have no idea why. I also tried that custom-icon.png asset from the example-app but that does not look sharp as well. How is your experience?
sorry, l also don`t have a good idea. but it seems to be working normal on ios
I'm trying to add an image (Uint8List) to the maps style, so that I can reference it later in a feature when I assemble a source geojson. This is what I tried:
Andriod 13.0.
The error thrown is: