4

In my app I have a map which is "powered" by GoogleMaps, but sometimes there is a need to use the map offline, so I decided to add support to osmdroid. With a few adjustments to my previous code I managed to get it working it all the features that the GoogleMaps one had.

Now my problem.. in GoogleMaps' mapView the icons appear like the one in the following image:

GoogleMaps icon

But in the OSM's mapView the icon is very big and blurry:

OSM icon

I tried to reduce the size of the image (the *.png object) to see if that was the problem, but the icons remained big and blurry, my guess is that osmdroid is for some reason scaling the icons to a predetermined sized, is there a way to change it?

I have searched around for a couple of hours and I haven't found anything useful yet, so I decided to try my luck around here. Thank you :)

Marco Batista
  • 1,410
  • 1
  • 20
  • 38

1 Answers1

1

By chance a friend of mine stumbled across the answer, Issue 331

The issue was solved in a revision, here's what I did:

get:

then add them to your project and then extend/use these files instead of the osmdroid's library files. With this I managed to get the icon to look like the ones in Google Maps (except the shadow, but that wasn't something that I realy wanted)

fixede OSM icon

Marco Batista
  • 1,410
  • 1
  • 20
  • 38
  • Sorry, can you explain how/where to add those two files? I'm adding the icons like in this question: http://stackoverflow.com/questions/10533071/osmdroid-add-custom-icons-to-itemizedoverlay – AlvaroSantisteban Dec 16 '13 at 14:34
  • Add those two file to your project (e.g.: copy/paste to com.example.app.osm). Then, assuming you have the class `MyItemizedOverlay` (as in the question you linked), make that class extend the `ItemizedOverlay` that you just added to your project. If you already had imported the one from the library simply change the `import org.osmdroid.views.overlay.ItemizedOverlay;` to `import com.example.app.osm.ItemizedOverlay;` – Marco Batista Dec 18 '13 at 18:00
  • No, sorry, I should have said that I was adding icons like the ANSWER of that question. The second approach would be the right one for me, but now I'm using ItemizedOverlayWithBubble from the bonuspack. My lines are: ExtendedOverlayItem overlayItem = new ExtendedOverlayItem(PARAMETERS); Drawable icon = new BitmapDrawable(getResources(), anEntity.tagsList.get(0).icon); icon.setBounds(PARAMETERS); overlayItem.setMarker(icon); – AlvaroSantisteban Dec 19 '13 at 09:52
  • Sorry I never used the bonuspack, but I guess the principal is the same. Find the equivalent files to the ones in my answer and make the necessary changes to make it work (refer to the commit changes of the files I linked) – Marco Batista Jan 04 '14 at 10:53