1
1

I would like to display 20 polygons on top of Openstreetmap data in my Android app, does anyone have working code for doing such a thing?

asked 16 Oct '12, 07:37

emj's gravatar image

emj
2.0k123447
accept rate: 15%

1

There are lots of resources available, but I really just want a good hands on tip with code, not a link like has been given before: http://wiki.openstreetmap.org/wiki/Android http://wiki.openstreetmap.org/wiki/Mapsforge and http://wiki.openstreetmap.org/wiki/Osmdroid

(16 Oct '12, 07:39) emj

A bit more information about what else you wanted the Android application to do might be helpful.

For example, this switch2osm Leaflet example might work pretty much out of the box under Phonegap on Android (it certainly does on Blackberry), and Leaflet supports drawing Polygons.

I don't have a "here is one that I made earlier" example, though, and depending on what else you want to do this may be a terrible place to start from.

(16 Oct '12, 17:37) SomeoneElse ♦

2 Answers:
1

You first need to decide whether you want to draw polygons over an existing pre-rendered map (i.e. Mapnik tiles) or if you would like to render everything yourself.

permanent link

answered 16 Oct '12, 16:19

gormo's gravatar image

gormo
2.9k32660
accept rate: 13%

Not really, rendering it all by myself is not something I would ask for here. Sure vector graphics vs. bitmaps is always an interesting thing to ask yourself, but I don't really care, what ever exists and works is good. I'm guessing very few people actually use OSM in Android apps.

(16 Oct '12, 17:05) emj
1

I would probably look into OSMdroid and a PathOverlay. Java source (and thus, API documentation) is at http://code.google.com/p/osmdroid/source/browse/trunk/osmdroid-android/src/main/java/org/osmdroid/views/overlay/PathOverlay.java .

(16 Oct '12, 18:04) gormo
1

You could read this great and very well-written tutorial.
It contains clear explanations, step by step, and some simple working code.
Following articles also talk about overlays, very useful in order to draw over the map.

permanent link

answered 19 Aug '14, 21:40

Graziano%20Capelli's gravatar image

Graziano Cap...
7115
accept rate: 0%

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×167
×110
×16
×9

question asked: 16 Oct '12, 07:37

question was seen: 26,012 times

last updated: 19 Aug '14, 21:40

powered by OSQA