I want to put a fixed marker in the middle of the screen where my map is located, and that marker will give me the other marker information that is nearby and provide me the neighborhood information where the marker is. Is this possible ? How can i do that ? I see a lot of apps having this functionality.
Edit:
where Should i use mMap.getCameraPosition().target Method? on CameraMoveListener?i want when CameraMove stopped this method starts
Answer Use this Method on mMap.setOnCameraChangeListener
You need to use Relative or FrameLayout and put one Marker ImageView in center of the screen.
Considering that the whole screen is of Mapview.
Now to get the centerpoint latitude and longitude you can use
mMap.getCameraPosition().target
That will be the exact position of your centered ImageView.
You can achieve Uber like location picker in same manner.
Related
I would like to ask that is possible to do this thing in the Google maps.
I have marker A which is displayed on map on some GPS coords.
I would like to add marker B which is randomly displayed in some radius from marker A (for example on the passed GPS coords).
Marker B should to start getting closer to Marker A with constant speed.
Marker B should to move closer to Marker A only on the streets,paths, grass, meadow (it means not throught the walls, water, etc).
Is it possible in Google Maps API?
And if Yes, could someone provide some example or link to tutorial?
Many thanks for any advice.
You want to animate your marker along route. It is possible with google maps api.
Look at the below url.
https://duncan99.wordpress.com/2015/01/22/animated-paths-with-google-maps/
Hope it helps you.
I have multiple markers set around on the map. What I want to know is how can I show only a few markers depending on the zoom level. For example: I have a zoom on the map with radius: the length between the center of the map and the bounds of the screen (lets say this is like 2km in real life not sure if this is true) so I want to show only the markers that are inside the radius. And of course if the user zooms out the radius will be recalculated again from the center point of the map to the bound of the screen. And again include markers that are inside the new radius. How can I achieve this?
I have thought about this problem and here could be an approach.
you can loop through your available markers and find distance from the center of your given circle (since we're talking about a radius) to the marker; this can be done using computeDistanceBetween(); for more info see link
If the marker lies within your radius, show, otherwise, hide using the setVisible() method. For more information, see link
Hope this gives you some idea.
I'm developing an application that has the following goal:
Using the google maps android API 2 I get my current position, and as I start walking the application starts drawing the route I take
The twist is that the map is a "blind" map. Meaning the map is hidden, only the Marker of my current position and a dotted line of my route is shown.
Keep in mind I'm a novice developing to Android, so please be specific. (Thank you)
I managed to create the map, get my current position and zoom in to it (Had no sens to see the whole planet while i want only my current position). And it's pretty accurate so far.
The thing is I don't know what should I do from this point on.
Basicly I need a white View between the Marker and the real map. Also as I advance that View should always be on, over the MapFragment/MapView. Also I wish to keep the zoom and drag functionality's of the MapFragment.
How can I achieve this?
At this point I'm opened to any solutions.
(Been browsing for a few days now the developers site, I have seen that with the ViewOverlay class I can put messages over the map, but I'm not sure what would the correct aproach be in my case...)
To hide the whole map behind the white view I would use Polygon class Polygon Even if you specify Polygon to cover the whole map Markers will be still displayed in front of it and as so user's current position marker will be visible. You also will be able to zoom and drag.
To draw line on map use Polyline class Polyline It will draw users path as a polyline. If you want to stick with dotted line you can use Circle objects to create it. Circle
I'm trying to create a custom "my location" button for my app using Google Maps.
What I'm trying to do is to center the map around the location of the user, which is already done and working flawlessly, but also want to zoom in just enough to see a marker of my choice (this is actually the closest of a set of markers I have in memory, but that's not important now).
I haven't been able to find how the zoom variable works here. If I know the marker I want to show is 0.5 GPS units away from me, how can I center the map around me in a way that includes that marker on its boundaries? I'd also use a padding to make sure it perfectly fits in the map.
LatLng my_coordinates = ...;
LatLng closest_mark = ...;
map.animateCamera(CameraUpdateFactory.newLatLng(my_coordinates));
So now I want to modify that code to not only center the position to my_coordinates but also make sure zoom will make closest_mark fit in the viewport
CameraUpdateFactory.newLatLngBounds( ?? , /*padding*/);
I don't think there is a specific zoom variable in the api you can control along with the points in the map. (And LatLngBounds just takes in the upper right and lower left bounds and gets you a view accordingly).
I believe what you could do is with a little geometry. If your marker is very close to your location (you can consider it a rectangle), get the distance between the two and extrapolate that on the opposite direction with the same distance (multiple by a small factor if you want some padding) to get the other coordinates, and then you can get the upper right and lower left coordinates (simple geometry).
If your marker is quite far and the surface of the earth comes into picture, you may have to use the haversine formula (great circle distance).
Hope this helps.
I want to show multiple users through markers on map. I want my location should be in center with marker and others are around me. I want to show different image marker for every user. I dont want to use same image for all the user's.
Any tutorial would be a great help.
You can use these tutorials and use custom Images for each user
Google Map View
Android: Double Taps on a MapView with Overlays