Mapbox uploading background image - mapbox

I'm trying to change the background of my map and put an image instead of it.
I'm currently using map box studio so when I'm choosing a local path
(c\deskstop\toto.png), it is working on the software, so if I choose to upload my whole map style, and use my map on the internet, it doesn't work.
I choose to upload the picture in my website then I changed the URL of the path too ( toto.com\pictures\toto.png). but it is till not working
Does someone has already this problem with mapbox?

Related

Is there a way to specify the file name in advance for the picture taken with the flutter camera plugin?

Hi I am using the flutter camera plugin and it works fine, the main issue I am having is that I can't find a way to tell the plugin the image file name when taking the picturee, in android using Kotlin this would be something like:
photoUri = FileProvider.getUriForFile(requireActivity(), "io.awesomedomain", photoFile) // build uri on the app storage space and specific file name -> photoFile.
captureImageIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri) // define the pic name before picture is actually taken by the camera.
startActivityForResult(captureImageIntent, REQUEST_PHOTO) // start the camera
I am currently just renaming the picture file name after the picture XFile returns from the flutter camera plugin but this doesn't feel optimal so I am wondering if I am missing something. Is it possible to specify the file name in advance to the flutter camera plugin?
I am currently using the latest available version at the moment: camera: ^0.7.0+2
OK, it looks like I had a misunderstanding of the Camera plugin, I noticed that the returned XFile places the picture in the cache directory and actually provides a method to save the picture to a more definitive storage xfile.saveTo so I did:
var appDir = appDocDirectory.parent.path; // get app directory
file.saveTo('$appDir${Platform.pathSeparator}files${Platform.pathSeparator}${weightPicture.pictureFileName}');
So the picture is properly saved under $myAppDir/files/picName.jpg where the files is a directory I configured to have permission to write to and the picName is defined by the application as I wanted.

Flutter - Cache_network_image. I replaced old image with new image with same name. But it doesn't affect on app

I am new to flutter. I have used library of "cache_network_image" which help to show images from the internet and keep them in the cache directory. In first load, it download the images and stored in cache directory(cache manager) and displayed in app.
Example. I have an image(test.png), it downloaded from network and stored in cache successfully. But If I replace test.png image with new image with same name of test.png. So It should display new image
with that same name(test.png). It's displaying only old image.
The cache_network_image library not working properly. Please share your thoughts.
no, it doesn't care whats in the end of the url, all it cares is whether file exists locally, if it doesn't then only it'll fetch from the url, if you want to refetch the updated image you have clear the cache, delete the app data or if you want to clear programmatically
var cm = DefaultCacheManager();
cm.emptyCache();

how to load an image to the playground

In the playground app, I am trying to upload an image, I google it and many solutions said that I need to put my image to resources. But the case is that in the new playground app, the is no resources folder that's why I couldn't add my image. There are shared Sources and Xcode sources but in these files, I couldn't put my image.
this can be an easy question but the case that I struggle with. And in order to continue my project, this point madden me. Thanks
as you can see, there aren't resources that ı could put my image
there is space for adding an image but in this case, the problem is that after ı chose my image nothing happened
UIImage can be loaded to the Playground app like this,
File --> New Blank Playground.
Click on the '+" icon on the top right corner and choose the picture by clicking Insert from... option.
Load the image with its name from the Playground.
UIImage(named: "test.png")
Output with loaded image

Flutter | how to add custom Icons in Mapbox's markers/symbol

I was wondering how one could use his own icons in a Flutter-Mapbox plugins' marker?
There's no default marker icon (no provided icon - no marker),
and there's not enough documentation on how to use a custom image.
adding a symbol (marker) is as follows:
mapController.addSymbol(
SymbolOptions(
geometry:LatLng(0.0, 0.0), // location is 0.0 on purpose for this example
iconImage: "pin"
)
);
whereas the IconImage, a String, is the field which should contain the data about the icon (obviously), but the given example repository doesn't clarify the needed parameters (url, path etc.).
Providing a path to the assets doesn't work (unlike other widgets). In the example, they provide the IconImage field the value airport-15, and when running the app, it actually works, but I can't seem to find the resources' location (it's not in #drawables or my assets folder, or any other place in the project)
You have to create a custom style on using MapBox Studio.
Create a new dataset if not already exist
Create tileset
Create new style & select customize basic template
Create new layer, give it a name for example my_sym and add newly created datasource
Then click on type & change it to symbol
Now click on my_sym two times. (first one will close the option menu & second one will open a new menu with symbol properties
Click on icon tab & select new icon. You can also upload your own svg icon.
Click on publish
Click on share it will show you the urls.
Copy the type of url & set styleString property.
For more info follow steps here
https://docs.mapbox.com/help/tutorials/add-points-pt-1/
API reference:
https://docs.mapbox.com/mapbox-gl-js/api/
As of release 0.0.5 it will be possible to load custom icon images for your markers. The idea is to add the icon image to your assets folder (for example: assets/symbols/custom-icon.png). If you specify this image as an asset in your pubspec.yaml and set the iconImage in the SymbolOptions to this path it will be loaded automatically.
Regarding the airport-15, this is an icon provided by the Android implementation of the plugin. It is part of the Maki Icons used in Mapbox. Because these icons are part of the Android implementation you will not find as a Flutter asset or an Android resource of the example app.

JavaFX 2.2 generated image not shown after building jar-file

In my JavaFX Application I generate a barcode with barcode4j by Apache, save it as png image in the directory /data/images/ and embed it in a web page which is shown on a JavaFX WebView.
After generating the barcode I embend it into the webpage using the following Javascript-Code:
path = "file:/" + path.replace(/\\/gi,"/");
var barcodeElement = document.getElementById("productBarcode");
barcodeElement.setAttribute("src", path );
barcodeElement.style.display = "inline-block";
I use the absolute path C:\path\to\java-program\data\myimage.png and build a file-URL from it.
Using this in Eclipse works without any problems. But when I build my project and start it from my jar-file the image is not shown. But the problem is not, that the path is incorrect or that generating the picture does not work, so that there is some kind of "not found" error. The place where the image should be is just white with a light border around.
And now the strangest part: If you right click on the image and choose "open in new window" the image is shown!
Does someone has an idea about that?
Thank you very much in advance!
My understanding is that the WebView won't let a page loaded with one protocol access files using another one. This makes perfect sense when you load through http://, and forbid file://. Here, you're loading through jar:file:..., and the webview will only let you access jar:file:... resources (I just tried, I can access an image from another jar file, from the same jar file, but not from outside!).
This sounds very much like a bug to me.
One workaround mentioned here is to use "data:" URI (i.e. encode the image directly in the HTML file).