Search code examples
androidkmlosmdroid

OSMBonuspack Custom KML marker appearing in wrong color


I've been trying to change the style of my KML so KmlPoint would be represented with a custom marker of my choice.

Here are the markers I'm using:

enter image description here

I successfully made the wanted points show up with the respective markers, but they look like a color filter might be applied to them or the bitmap is simply corrupted and I don't know why. Screenshot

Here is my code:

KmlDocument dryKmlDocument = new KmlDocument();
    File f2 = new File(appPath + "/dry_hydrant.kml");
    dryKmlDocument.parseKMLFile(f2);
    Bitmap blueBitmap = ((BitmapDrawable)ResourcesCompat.getDrawable(getResources(), R.drawable.blue, null)).getBitmap();
    Style dryStyle = new Style(blueBitmap, 0x901010AA, 1.0f, 0x20AA1010);
    ZoneStyler dryZoneStyler = new ZoneStyler(dryStyle, dryKmlDocument, osmView);
    dryKmlOverlay = (FolderOverlay)dryKmlDocument.mKmlRoot.buildOverlay(osmView, null, dryZoneStyler, dryKmlDocument);

    KmlDocument fireKmlDocument = new KmlDocument();
    File f3 = new File(appPath + "/fire_hydrant.kml");
    fireKmlDocument.parseKMLFile(f3);
    Bitmap redBitmap = ((BitmapDrawable)ResourcesCompat.getDrawable(getResources(), R.drawable.red, null)).getBitmap();
    Style fireStyle = new Style(redBitmap, 0x00000000, 1.0f, 0x00000000);
    ZoneStyler fireZoneStyler = new ZoneStyler(fireStyle, fireKmlDocument, osmView);
    fireKmlOverlay = (FolderOverlay)fireKmlDocument.mKmlRoot.buildOverlay(osmView, null, fireZoneStyler, fireKmlDocument);

Can someone point me to what could be causing this?

EDIT: Imgur didn't want to show up my bmp marker images so I took a screenshot in windows explorer instead.


Solution

  • Use PNG format, and ensure the corners are fully transparent (you cannot do that with the Windows Paint, you need something like IcoFX, Gimp, PhotoShop,... ).