Making OsmDroid city label text larger - android

I find the text/labels for cities and towns to be rather small. Is there anyway i can manipulate the text size?

Osmdroid works with tiles that are static PNG images. You can not change the tile images. If you want to have a better mapping solution try MapsForge. This app/library works with maps data and renders them dynamically. This way you have more control on rendering maps and you can customize its texts and fonts and colors.
Take a look at this:
Streetnames openstreetmaps more readable on Android

Related

Which kind of images is appropriate for VectorDrawable?

VectorDrawable is a new feature for Android after API Level 21, Which add support for vectorgraph. But I have a question for VectorDrawable, is it suitable for me to replace most of images in my project to VectorDrawable. In the android offical dev site I saw a few words :
A vector drawable is appropriate for simple icons. The material icons provide good examples of the types of images that work well as vector drawables in an app. In contrast, many app launch icons do have many details, so they work better as raster images.
Is that means VectorDrawable is only appropriate for simple icons like offical material icons, images have many details aren't appropriate to use VectorDrawable.
Sorry for my poor english skills, hope you guys can understand me! 😬
I plan to use VectorDrawable for all my project image resource if it is ok.
You're basically right.
Vector images describe shapes and geometry, and need to be rendered into bitmaps (a grid of pixels). This requires some math, calculating the pixels that represent the lines and curves defined by the icon.
The more complicated an icon gets, means the more shapes that are required, and the more calculations that need to be done.
On the other side, if you already have the icon rendered to a specific scale, like with png images, all of the pixel values have already been calculated. Now it just needs to be converted to a bitmap and scaled to the size it gets displayed at.
So depending on the situation, an icon may be able to decode and scale from a png file faster than rendering from a vector drawable, or vice versa, it all depends on the icon.
It's hard to say exactly how simple an icon needs to be, so try it out and make sure it runs well on a range of devices.

How can I manipulate and display SVG graphics on Android?

I would like to draw technical illustrations in my Android app.
I have images with shapes, and I have to change the size of those shapes based on input data. Thought that I could save those images as SVG, then I could manipulate the size of the shapes in it. For example, I would like to take a with a specified ID, and change its width/height.
There're great SVG display libraries for Android, but I haven't found one which can also manipulate the graphics.
Do you know any library which can do this?
If not, how else should I draw my illustrations?

appropriate container to display images one by one

I am new in android development. And I am building a location based app like google map(To some extent,we are reinventing the wheel :( ).
Like maps.google.com,the map data is generated as tiles in server and re-organized in the client. And in the html page,its easy to find the container to hold the tiles. For example,we can create some img element accordingly, and then put these imgs inside a div element.
Now in the android,which is the appropriate container to display the images?
In fact, I am reading the docs Displaying Bitmaps Efficiently, and it seems that ImageView is the only way to display the bitmaps. If this is true,then I have to create several ImageViewS dynamically according to the tile size and the size of the user screen. Also,according to the docs,AsyncTask should be used for performance enhancement. So each created ImageView will hold a AsyncTask,I am afraid which will out of my control.
So I wonder if there is any other solution can meet my requirement?
BTW,we use the tiles now,but we also have the plan to support the vector data which seems to have to use the opengl,so switch between different map types should be under consideration .
Update:
If as Raghunandan suggested I should use the ImageView to hold the satellite bitmaps in my app,but how about the vector data which should be still drawn use the opengl,then how to switch between these two types(views)?

Openstreetmap Overlay Osmdroid example

I am looking at the SampleWithTilesOverlayAndCustomTileSource example in the osmdroid pack and I am wondering where the overlay is coming from/what format the overlay openfietskaart-rcn is - is it Openlayers/a WMS service and how can I make my own custom overlay working for this example? Would it work with GeoServer? I was not able to find tutorials on this example and hope someone can give me a hint on how to create my own layer, based on a .kml file for example. Thanks!
this.mCustomTileSource = new XYTileSource("FietsRegionaal", null, 3, 18, 256, ".png",
"http://overlay.openstreetmap.nl/openfietskaart-rcn/");
example here:
http://code.google.com/p/osmdroid/source/browse/trunk/OpenStreetMapViewer/src/org/osmdroid/samples/SampleWithTilesOverlayAndCustomTileSource.java?r=829
The custom tile source doesn't specify a custom URL scheme, so you can assume it uses the default implementation - a folder structure of PNG files starting at the base URL above, followed by zoom/X/Y.png. The numbering matches Google Maps system. Each PNG is 256 pixels square. You can create a custom set of tiles using Mobile Atlas Creator (MOBAC), or I used a library called "mapnik" to convert KMLs to tiles. The tiles could also come from your sdcard.
Here's a good site to show how the tiles are numbered:
http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/
MOBAC:
http://mobac.sourceforge.net/
Mapnik:
http://mapnik.org/

Streetnames openstreetmaps more readable on Android

I've build an Android APP with offline map data using Openstreetmaps and OsmDroid. On a device with MDPI 320x480 pixels the map looks OK, but on a device with a HDPI screen with 480x800 pixels the street names are small and a little bit harder to read them. My map data till zoom level 18, the maximum I could download and use with Mapnik tile source, is loaded as a zip-file from the SD-Card. My local maps are from a defined region of Brussels (Belgium).
A screenshot of an MDPI device with 320x480 pixels:
A screenshot of an HDPI device with 480x800 pixels:
If you see these views in the app on the device the MDPI map is good readable, in the HDPI map the street names are smaller.
Is there a way to make the street names also more readable on the HDPI device, so the user haves the idea that he zooms one step further on the map? Because it's not possible to go to zoom-level 19, because there is no openstreetmaps data for it. So a little workaround solution with easy and small implementation time/work my be OK for me. Zooming is now done by swiping on the map. If you also need the code, let me know and I'll post it.
Thanks in advance.
Kr
Osmdroid works with tiles that are static PNG images. You can not change the tile images. If you want to have a better mapping solution try MapsForge. This app/library works with maps data and renders them dynamically. This way you have more control on rendering maps and you can customize its texts and fonts and colors.
In this answer I will explain a little bit how I changed the size of the street names.
In the jar file of MapsForge there is a xml-file included that will standard be used for rendering the map data. You can download this file also by checking out the source code from the server: http://mapsforge.googlecode.com or download the xml-file itself from here: http://mapsforge.googlecode.com/svn/trunk/mapsforge-render-theme/src/main/resources/osmarender/osmarender.xml. So, you have a basic to tweak your own render file. I tweeked it a little bit like this:
(snippet of the xml-file):
On the Wiki-page of the MapsForgeRenderThemeAPI page (on the site above) you can find how to tweak your own render file and what e, k, v attributes in the rule element means. As you can see there is a rule element with e="way", k="area", v="~|no|false" inside the no-tunnel way rule-element somewhere under the way rule-element. Every rule-element under this element haves
an e="way", k="highway" and v value equal to the openstreetmap parameters. As you login to the edit page on openstreetmap.org you can find out the kind of streets you want to tweak the names for.
Now I gonna tell how you can exactle the font-size you want for a specified type of street. As an example I will take the tertiary road element. Each kind of way rule-element contains some code like this:
<rule e="way" k="highway" v="tertiary">
<line stroke="#ffff90" stroke-width="1.5" />
<rule e="way" k="*" v="*" zoom-min="14">
<pathText k="name" font-style="bold" font-size="32" stroke="#ffff90" stroke-width="2.0" />
</rule>
</rule>
The line element specifies how the street will be displayed (color, width, black border, ...).
There is again a rule-element inside here containing a pathText element. This element specifies how the text will be displayed inside the stroke(color, width, font-size, ...). So, this is the element we need! In my example, as you can see, the font-size for the street names for a tertiary road will be displayed with a size of 32 pixels for a zoom-in-level of 14 or higher.
Now we want to use our own render theme xml file:
I've added my own render-xml file in the assets folder of my project. Than a t launch time, I copy the file to a location from where I can read it out when it is needed. In the activity where you handle your mapsforge map you only have to link to this file by implementing code like this (example):
File f = new File(Environment.getExternalStorageDirectory(), myRenderTheme.xml);
mapView.setRenderTheme(f);
Note that setRenderTheme(File) will throw a FileNotFoundException.
So, this is all for changing the street names with mapsforge. You can render you're whole map as you want!
Thanks to the MapsForge development community.
Have fun!
Kr

Categories

Resources