Android: override Google Maps v2 maximum zoom - java

I'm developing an app which needs maximum zoom set to level way past upper limit in Google Maps V2 (for an indoor navigation). I'm looking for a level 22, 23 or even 24.
Two solutions came into my mind:
Max zoom limit in Google Maps can be overwritten.
Use translation and render one small tile into a big square build from nine tiles or more. Tile quality is not an issue for me.
Are any of these ways possible? Or maybe there is another map engine, that supports zooming past level 21? Thank you in advance for your help.

Maybe googleMap.setMaxZoomPreference(value), but I didn't try.

You can use inbuilt method,
googleMap.getMaxZoomLevel()
Using above method you will get maximum zoom level, you don't need to set it manually.

Related

Samsung Galaxy 4 classic bezel rotation detection in Android Studio (Java)

I want to be able to add a value to an integral that I have:
Rotating clockwise would increase the value by one
Rotating counter-clockwise would decrease the value by one
I tried searching and I found "rotary input", but I didn't really manage to put it in practice (I mostly found it all talking about scrollview)
How can I achieve it?
For Compose you can use the onRotaryInputAccumulated modifier from Horologist
Example for volume control
https://github.com/google/horologist/blob/94552e13ea45613cc9b804ee7080b4aa92311d54/audio-ui/src/main/java/com/google/android/horologist/audio/ui/VolumeScreen.kt#L108-L114
The raw events come from onRotaryScrollEvent how to implement positionindicator for bezel (Galaxy watch 4 Classic) wear os 3.0 (jetpack compose)?
For Views use https://developer.android.com/training/wearables/user-input/rotary-input

How to set Google map on max zoom level to 30 in Android?

Let me tell you from the start it doesn't work:
mMap.setMaxZoomPreference(30.0f);
I know Google Maps doesn't allow to zoom above 21 but I saw in Javascript you can add a new maptype and set max zoom level to 30 or whatever you want. https://developers.google.com/maps/documentation/javascript/examples/maptype-overlay
I find a link for Java to add new Tile but I dont understand how to use for adding new map type and set max zoom: Google Maps API v2 draw part of circle on MapFragment
How to set Google map on max zoom level to 30 in Android?
Yes, maybe the reason Android SDK is only on V2 so does not have the same feature set (yet) as the JS SDK.
But maybe there is another way or hack something. Is there any other solution?
Looking at the android docs: https://developers.google.com/android/reference/com/google/android/gms/maps/CameraUpdateFactory
It states:
"the desired zoom level, in the range of 2.0 to 21.0. Values below this range are set to 2.0, and values above it are set to 21.0. Increase the value to zoom in. Not all areas have tiles at the largest zoom levels."
I believe the reason you can do this in JavaScript is because the JS google maps SDK is currently on V3, whereas the Android SDK is only on V2 so does not have the same feature set (yet) as the JS SDK.

Android map API V2. GroundOverlays over Polygons

I am working on a mobile Android map of my university campus using Google's Android map API. I have currently used Polygons to color in each building according to their faculty. I have also placed GroundOverlays to show where each food place/ATM is. However, the Polygon's seem to lay on top of the Groundoverlays, but I want the opposite to happen. Is this possible?
you must use Zindex to change the layering of items:
put polygons without setting zIndex (or set a low value), then put ground overlay zIndex to hundreds (or thousands) and you are done!
https://developer.android.com/reference/com/google/android/gms/maps/model/GroundOverlay.html#setZIndex(float)

Android map overlay with sprites pathfinding

I want to make an Android App, with a real map and a overlay for the map, where sprites are drawn (can be dots or small images).
This is a rather hard question, so I have made a sketch of a map of a small city, where only roads and streets can be seen. That might look something like this on the device:
Imagine the red dots to be bots, and they want to get to the yellow dot, assuming they know the position.
What Android Map API should I use to be able to:
Draw custom sprites on a given location on the map (geo-coordinates rather than screen coordinates).
Generate valid paths from the streets and roads on the map, which the dots can move on (black lines).
Use pathfinding to calculate the shortest routes, e.g. from red dot to yellow dot.
Must be able to draw more than 10 sprites on the map.
(the map doesn't have to support 3d views or street views. Plain old top-down view is just fine)
If no map API exists that does not meet these requirements, what are some other solutions?
I'm really excited about this project, but I'm having a lot of trouble getting started with it, so any help or guidance will be much appreciated.
EDIT:
It seems that there is no answer to my question. I will leave this open and report back with my own solution.
Google Maps Android API v2 and Marker class.
All valid paths? You probably should not need it if you use Android API v2 with real map drawn for you, but you can also try to use Google Directions API.
Google Directions API.
No API exist that can handle more than 10 objects. You probably need something from NASA.
Have fun coding.

Algorithm to determine which points should be visible on a map based on zoom

I'm making a Google Maps-like application for a course at my Uni (not something complex, it should load the map of a city for example, not the whole world). The map can have many layers, including markers (restaurants, hospitals, etc.)
The problem is that when you have many points and you zoom out the map it doesn't look right. At this zoom level only some points need to be visible (and at the maximum map size, all points).
The question is: how can you determine which points should be visible for a specified zoom level?
Because I have implemented a PR Quadtree to speed up rendering I thought that I could define some "high-priority" markers (that are always visible, defined in the map editor) and put them in a queue. At each step a marker is removed from the queue and all it's neighbors that are at least D units away (D depends on the zoom levels) are chosen and inserted in the queue, and so on.
Is there any better way than the algorithm I thought of?
Thanks in advance!
I had a similar problem and you cannot avoid having overlapped icons regardless the method to mark some icons as high-priority.
What I did(it might not be easy to apply in your case - in my case the map was rendered in a desktop application, with much more control above the rendering process) was to sort based on priority, and paint only markers which are not overlapping - showing also a message like "XXX overlapping markers removed". This way the user doesn't become overwhelmed with information and he still sees the most important information.
I hope this helps.
Not sure I understand completely, but perhaps you can assign each layer a "neighborhood density," based on the inverse of the average distance from each point to its closest neighbor. For a particular zoom level, you would calculate a maximum density that is comfortably viewable and use that as a threshold.
I have some experience in designing a map application from scratch I would recommend you to split the entire world into 16 zoom levels. Zoom Level 0 should show the entire world and Zoom level 15 should cover the street data.
Typically, you would have to use the zoom levels 0 to 3 to have boundaries of the countries. And each zoom level should have a zoom range of 1/4th of the previous zoom range. You can have a zoom to table map (assuming you are using a database to store the spatial related data). Once you define the zoom levels and the range of the zoom levels to table mapping you can have finer control on querying the data. And its recommended to construct a R-Tree indexing for your map data.
Each and everytime you get a layer/table (assuming a layer can be either a country boundary or a railway track or a street), its advisable to define a zoom level by yourself instead of spending time in finding an algorithm since the number of layers are not going to be huge.
I can keep going, but if you want specific answers, I can address them as well.

Categories

Resources