Android Google Map: how to combine multiple overlays together - android

In my project, I have to show more than 3000 overlays on the map, each of them got a unique position, which causes the program too laggy.. I guess the problem would be my program has to update or refresh the shape of each overlay individually for the screen. My idea is to combine the 3000 overlays together into one, but I still don't really know how to make it out.
Could anybody give me any ideas?

You may use 'Polygon', A 'Polygon' is like a poly-line. A series of connected coordinates in an ordered sequence, It also form a closed loop and define a filled region.
For more information, please view Official Google Documentation for Combining and visualising multiple data sources: https://developers.google.com/maps/articles/combining-data
Also, Here's a related Stack overflow ticket, it might help you: Google map multiple overlay no cumulative opacity

Related

Use own image as map and mark places using x,y coordinates in android

I need to use my own image as a map and place markers (or a small flag-image) dynamically on the map at different positions (x,y coordinates or l,t,r,b parameters) on the map based on certain criteria. I am having problems implementing it with 'ImageView', 'ImageMap' & 'Drawable' and have searched all questions on stackoverflow. Any help would be appreciated.
I did something similar to this for my very first app. Inside of my activity, I created a custom View class, where I overrode the onDraw method and drew my map image, flags, etc. This is the tutorial I used, I recommend you check it out: Anddev.org (you may not need to implement scrolling, but the rest of it should be relevant).
Alternatively, you can use the Google Maps API to display their map with Overlays but it doesn't sound like that's what you're looking to do.
You have to user Overlays for displaying images on a map. A very good tutorial is given in the official docs.

What is overlay in android?

I know how to use Overlay in Android applications i used it plenty of times.
But now i am wondering what actually meaning of the Keyword overlay in general terms.
one basic definition is
Overlay is the individual items placed on the map
Generally, names to Classes, keywords are given in context of their real meaning. The dictionary meaning of overlay is:
Cover the surface of (a thing) with a coating: "their fingernails were overlaid with gold".
The same applies to Android. And like you said:
Overlay is the individual items placed on the map
generally used to show image top of a map like pin on the map surface
Demo Link
API link

Android: Custom region map

I am trying to implement a map(not Google maps) like in the below image, which will have a hypothetical regions(not administrative) with different colors to indicate the population density. The regions will also be clickable and cliking on that will open a small info overlay.
For now I have the sliced images for each region with multiple colors (which color to be used is determined from an API request). But I am not exactly sure how can I implement this in Android? I've been doing some research for past couple of days but couldn't find anything satisfactory so far.
Things that I am having trouble to implement:
Put together all those images and form the map
How can I detect "tap/click" event in the regions
In one brief conversation with a guy, he mentioned something of "greyscale overlay-map, that is not visible to the user and which determines the right area by testing against the greyscale color index", frankly I didn't understand what he meant.
Here's what I am trying to achieve:
Any help or pointer to the right direction would be of great help.
Thanks for your time.
Check out www.trimaps.com, I think this is what you want. Sadly it isn't free.

How to buil a clickable custom map using path and region in Android

To explain my problem, I am going to start from a case study that is not what I have to do but which will give you a good idea of what I am talking about.
Imagine the map of the US in which you have the states / provinces. Each of these provinces has got a shape that is random (by random I mean it is not a rectangle, a triangle or a circle). I need to build these shapes independantly, size them correctly and put them at the correct place on the screen to represent the country. Finally, each of these province should be clickable.
To achieve that :
1) I don't want to use google map
2) I guess that I'll have to construct each provine using android path and android region ... can you confirm?
3) Is there a graphical tool for building these paths (photoshop import ?)
4) Assuming that I succeed to build the path, how can I put them at the correct place on the screen ?
5) How can I make these path clickable ?
Basically, I want to build an interactive map with clickable items that doesn't use Google map because it won't necessarly be a real map.
Thanks for your help,
R.
There are lot of variables in the problem you describe:
If you don't want to use google-maps, you'll need to use another engine. There are a few open-source ones available.
If you feel you don't need a map engine, you'll need to provide you're own image of the US to draw on an pin the image to the View
How do you plan to draw the boundaries? Do you have coordinate data for the boundaries or do you plan to draw them manually.
I would suggest first looking at openstreetmap: http://www.openstreetmap.org/ The have a lot of information and tools on creating Maps. From there you can attack adding to the phone. Or you can use their web api and build a web view for doing what you suggest.

Showing the Google Maps reticle on Android

I'v encountered a problem with Google Maps on Android. In my app I have a location-chooser where the user navigates to his desired location to save the exact street location. In order for the user to actually see what street he is no (and not just the general area) I need to mark the middle of the map clearly.
The problem is that the reticle (the little circle marking the center) from Google Maps usually won't show. It appears at the most 1 out of 10 times I open the map, probably less. This happens regardless if I add other overlays or if I just show the map as is. I am aware of ReticleDrawMode and have tried setting it to DRAW_RETICLE_OVER, but this does not seem to work (and it should be the default already).
Have I missed something here? I have searched for the problem and from what I have see the problem seems to be common, but I havn't seen a solution for actually forcing it to always show, only for hiding it.
If the reticle is broken, does anyone have a good suggestion for how to create a custom one? As I said the the user will navigate the map, so I can't just do a normal overlay on a fixed point of the map, and the map also does not take up the full screen so drawing something over it is a bit ugly (although I guess that will be my last resort).
And of course I found the answer just after I asked the question, or at least part of the answer.
I haven't found out how to get the reticle to work, but the easy workaround for this is to use the fact that different widgets can overlap each other in a RelativeLayout, whichever is declared last will simply lay above the other. So I ended up putting the MapView in a RelativeLayout and then simply placing a TextView in the center of the same layout. The TextView is now over the center of the map and can be used to mark the middle.
(Going to replace the TextView with something more appropriate later, but the concept stays the same).

Categories

Resources