Streetnames openstreetmaps more readable on Android - 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

Related

Flutter Google maps Markers incorrect size on iOS

The size of the markers on the map look different on iOS than android. I have tried several things, and the only thing that worked for me was changing the bitmap file of the google map plugin.
return BitmapDescriptor._(<dynamic>[
'fromAssetImage',
assetBundleImageKey.name,
4.0, // <= Replace 'assetBundleImageKey.scale' by '4.0'
]);
Is there a way to control the size of the asset? I tried modifying the image configuration size but this had no effect on either platform.
Secondary question, my marker is a simple circle with text in it. Is there a way to draw the circle and text with code and create a bitmap from that?
EDIT: I solved this issue by recreating all of the assets with the desired resolution and a 2x and 3x file. I generally do this working with Xcode and swift, but I inherited this project and the original assets did not include 2x or 3x.

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 to make an epub reader and display as imageview in android

would someone provide me with the code to read an epub book and display as webView , I have tried my best to get the needed code but never got it so i wish if someone would post it for me, I need a step by step procedure as i am a beginner i am using eclipse thanks in advance
You can try CoolReader here, and FBReader here.
1.epub (non-DRM), fb2, txt, rtf, html, chm, tcr, doc, pdb formats supported
2.Pages or scroll view
3.Table of contents
4.Bookmarks
5.Text search
6.Hyphenation dictionaries
7.Most complete FB2 format support: styles, tables, footnotes
8.Additional fonts support (.ttf)
9.Can read books from zip archives
10.Automatic reformatting of .txt files (autodetect headings etc.)
11.Styles can be customised in wide range using external CSS
Android specific
Page flipping animation.
Built-in file browser, quick recent books access
Day and night profiles (two sets of colors, background, backlight levels)
Brightness adjustments by flick on left edge of screen
Background texture (stretched or tiled) or solid color
Paperbook-like page turning animation or "sliding page" animation
Dictionary support (ColorDict, Fora Dictionary, Aard dictionary)
Customizable tap zone and key actions
Place additional textures to /sdcard/.cr3/textures/ -- to be used as tiled page backgrounds
Place additional textures to /sdcard/.cr3/backgrounds/ -- to be used as stretched page backgrounds (/cr3/ directory can also be used instead of /.cr3/, and internal SD or internal storage instead of /sdcard/)
TTS (text-to-speech) support
Select text using double tap (optional)

how can i highlight image in android

My Android application have to show an image include 16 parts that download from server (for example the human
body), the user can touch some specific part of this image (for
example the head or the stomach) and this part have to be highlight in
some way (for example by displaying a dark - transparent layer around the image so
the highlight image can see clearly )
So how can I highlight an image when still loading the other images .
And can I support it from 2.1OS .
Thanks in advance !
Sorry for my poor english !
If your big image exists from smaller pics, Java has a class named MosaicDescriptor
The "Mosaic" operation creates a mosaic of two or more source images. This operation could be used for example to assemble a set of overlapping geospatially rectified images into a contiguous image. It could also be used to create a montage of photographs such as a panorama.
All source images are assumed to have been geometrically mapped into a common coordinate space. The origin (minX, minY) of each image is therefore taken to represent the location of the respective image in the common coordinate system of the source images. This coordinate space will also be that of the destination image.
Detail and reference

Making OsmDroid city label text larger

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

Categories

Resources