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

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.

Related

How to identify that asset added inside Assets.xcassets are used in project?

How to identify quick way the Assets added inside Assets.xcassets for Images & color are using inside project or not.
Example:
int value = 10
In this case int value not used inside application which give an warning.
Initialization of immutable value 'value' was never used; consider replacing with assignment to '_' or removing it
What if inside Assets.xcassets added color or image are not used how to identify ?
Xcode has no tool which could highlight not used assets but there is a open source project called "AssetsChecker" which will do the job.
There's no way a tool can know which assets are not being used by your application.
Imagine that you are creating a Weather app, and the data you receive from the server includes the image_key that you use to know which asset to load.
If a tool to find unused assets was used, it would tell you that every image or color that is not referenced directly is not used, which would yield a LOT of false positives.

VSCode extension api – file type/extension icons using ThemeIcon

We are building an extension that visualizes some data for workspace files in our view using a class derived from TreeDataProvider. We wonder if there is a way to use file icons contributed by the current File Icons Theme for our custom tree items. Base icon class has a field icon: ThemeIcon which supports product icons. Wonder if something similar exists for referring to file-type icons?
Thanks
Seems like using resourceUri and ThemeIcon.File is the way to do it:
this.iconPath = ThemeIcon.File;
this.resourceUri = Uri.parse('_.js');

Is there a way to add a custom icon to map's Mapbox?

I might have skipped some documentation about flutter_map plugin, but I could not find any way to use a simple .png image as a custom icon for a Mapbox marker?
Should I maybe use another plugin? Or is there a way to do what I attempted to do?
You can do that with the mapbox_gl plugin by calling
MapboxMapController.addSymbol(
SymbolOptions(
geometry: LatLng(latitude, longitude),
iconImage: iconImage,
);
You can use the name of one of your asset images as iconImage or the name of one of the icons included in your style (e.g. 'defaultMarker' should be included in every style).
There is also an example of this in the place_symbol.dart file of the plugin's example project.

Mapbox uploading background image

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?

Images in Interface Builder when using MonoTouch

I'm new to MonoTouch and iPhone development. I have my images (PNG) in a resources folder in MonoDevelop, however if I want to set the image property for a button in Interface Builder, how do I do that? It's always a blank dropdown. Do I need to use XCode to access the XIB file and then somehow embed the button image file I'll need in it?
This is a known limitation of MonoDevelop and Interface Builder. To add images to an XIB in Interface Builder they must be part of an XCode project, which of course coming from MonoDevelop they're not.
To achieve what you're trying to do you will need to set the image via code, and ensure the build action of your image is set to Content. To do this, simply right click your image inside MonoDevelop, and select Build Action > Content.
On your view with the button on it, create an outlet in Interface Builder for your button, hook it up, then from code to set your image, you just need to use the .FromFile("path/name") method of UIImage.
UIImage buttonImage = UIImage.FromFile ("resources/image.png");
myButton.SetBackgroundImage (buttonImage,UIControlState.Normal);
That's off the top of my head, but I think that should do it.
You can manually set the image in Interface Builder, but it wont show up until run time. The image name can include a path, e.g. "images/settings.png".
All solutions given here are completely wrong and misleading. All you need to do, is place your images in the Resources folder (on the project root), and add your images to this folder. After adding files to this folder, mark all files and make sure their build action is set to BundleResource.
I also needed this to work, here is a workaround I found.
You need to create a dummy xcode project. Place it in the same folder as your project.
Add all your xib files and image files to that xcode project by dragging them in when the project is opened in xcode. Now you will be able to see the preview of the images.
The image files must be in the same folder as the project file and xcode must be opened with the dummy project while the interface builder is opened.
Not great - but solves the issue for now.
Here is a sample project I have created.
For this issue to be resolved on the MonoDevelop side - some inter-process communication code needs to be created, I think that a good starting point will be looking for "PBXProjectWatcherServerConnection-3.1.2" in google.