customize the pin of map Android - google-maps-android-api-2

Hello I would like to add a dynamic display with a number in my point.
As in the picture, I already have the icons on the map.
Adding the numbers in point?

You may use android-maps-utils to achieve such effect.
Simply create 9-patch out of your pin with empty rectangle above and make rectangle be the content.
Then use IconGenerator to create a Bitmap with your text and 9-patch like here:
IconGenerator factory = new IconGenerator(context);
factory.setBackground(your9PatchDrawable);
factory.setContentView(textViewWithWith3Point600String);
Bitmap icon = factory.makeIcon();
Then use this Bitmap to set Markers icon:
map.addMarker(new MarkerOptions().icon(BitmapDescriptorFactory.fromBitmap(icon)...);

Related

Setting the CRS for non-geographical svg map

I'm trying to show a custom non-geographical map with CRS.simple as explained here:
In a CRS.Simple, one horizontal map unit is mapped to one horizontal
pixel, and idem with vertical
However, I wish to use an SVG vector image as an overlay, but I don't get how the map unit is decided in this case, since the vector images don't really have a resolution?
Also, how could set the CRS origin's location to a specific point?
Thanks for helping

How to set up icon dimensions in Leaflet.IconMaterial?

I'm using the Leaflet.IconMaterial plugin for my leaflet map, but I can't set the dimensions of my icon. How can that be done?
You can't. The dimensions of those icons are hardcoded, here for the size of the icon:
svg.setAttribute('width', '31');
svg.setAttribute('height', '42');
...and then here and here for the coordinates of the circle and the path that together form the "reverse drop" of the icon:
backgroundCircle.setAttribute('cx', '15.5');
backgroundCircle.setAttribute('cy', '15');
backgroundCircle.setAttribute('r', '11');
path.setAttributeNS(null, "d", "M15.6,1c-7.7,0-14,6.3-14,14c0,10.5,14,26,14,26s14-15.5,14-26C29.6,7.3,23.3,1,15.6,1z");
Note that the coordinates of the path points as well as the circle fall inside the width and height of the SVG.
Your best bet would be to make a copy of Leaflet.IconMaterial and change those hardcoded values yourself, and/or apply a scaling transform to the circle and the path inside the icon's SVG. Or better yet, make those values configurable via options (then, ideally, document those modifications and merge the code back with the original Leaflet.IconMaterial git repository).

Leaflet: How to display markers behind polygons?

I need icons (PNG) and polygons on my map. So I create icons as markers and polygons as polygons. Unfortunately regardless of creation order polygons are displayed "below" markers. I need is vice-versa. Is there a way, how to do it?
EDIT:
Correct default panes order in Leaflet 0.x: (from top-most to bottom-most)
objectsPane
popupPane
markerPane <= all markers icon (other than L.CircleMarker)
shadowPane <= all markers icon shadow
overlayPane <= all vectors (including L.CircleMarker)
tilePane
So just using the marker's icon shadow is not enough. You have to manually change the z-index of those panes in CSS (or through JS).
See also Leaflet: Polyline above Marker.
Original answer:
The stack order of vectors (like your polygons) and Markers is fixed in Leaflet 0.x. They are inserted into "panes" which order is (from top-most to bottom-most):
popupPane
markerPane <= all markers icon (other than L.CircleMarker)
overlayPane <= all vectors (including L.CircleMarker)
shadowPane <= all markers icon shadow
tilePane
So you should be able to easily workaround this fixed order by using the Marker's Icon shadow. If you still want the user to be able to click on your marker, simply use a transparent image for the normal icon, with the same size as your shadow image.
The situation is different in Leaflet 1.0. You can create your own panes (map.createPane), set their order by specifying their zIndex (possibly through CSS), and specify where your vectors and markers go by using their pane (and shadowPane for markers) option(s).

How to fill custom area in mapbox?

I have following map in mapbox editor:
Is it possible to fill custom area of the map ? (in this example, area is selected, I can see its attributes)
How can I do it?
You'll want to filter the data and then polygon styles to style the layer.
For instance, if the ID you can rely on is ID_0, then
#GEO_adm2[ID_0 = 81] {
polygon-fill:#f00;
}

How to crop image on selecting certain area of it

I would like to crop image by selecting some area of it by dragging it over image.
I hope this helps, its a jquery plugin http://deepliquid.com/projects/Jcrop/demos.php?demo=handler which help u get the coordinates for the crop region. when you get those coordinates you can use the
following function in c#.
Rectangle CropArea; // assign the rectangle the x,y cordinates.
Bitmap bmpImage = new Bitmap(img);
Bitmap bmpCrop = bmpImage.Clone(cropArea,
bmpImage.PixelFormat);
return (Image)(bmpCrop);