I am working on google maps application and I have data in KML file of 1 area. I can successfully add the layer to map when a button is pressed, Now I am searching a way to add the layer when a user viewing that area at a particular zoom level. I can able to add a layer at a particular zoom level that I want but I am unable to find a way to add a layer when an area is visible on the map any help or sample code will be useful for me.
Thanks in Advance
You can get the current area of map displayed on screen and show your layer accordingly.
Step 1 : Get the total area of map covered on current screen. You can get the region by using this link.
Step 2 : Get all the marker latitude and longitude from kml and check whether that exists between region bounds of step 1.
Step 3 : If there exists the latitude and longitude then simply draw a marker on the map.
Related
I fetch lat-longs from an API and display them on the Google map. Now, I am offering a drawing tool which lets the user draw on the map and apply this to get the pins in just that specific drawn area by the user.
How do I achieve this?
Thank you!
Screen 1: Shows all the pins based on the lat long.
Pins on the screen
Screen 2: Draw Feature that will let the user draw. User Draw Feature
Screen 3: This screen will fetch the pins in just the area selected in Screen 2 by the user
Get the positions or the shape of the drawing.
Draw that as an polygon shape on the map, then filter out the markers or fetch only the markers inside that shape. You can follow this guide on Android Dev, And here is some more information on markers.
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.
I am new to android.I would like to know how to put a google map current location in circleI want to know how to set google map current location inside the circle
If you want to create a UI with an opening in which your google map is behind, you can create a circle with a transparent interior. You can get more information on this here.
Note, however, that if your circle is not located at the center of the screen, you will need to find the offsets and move the camera to the respective location given these offsets.
In my app I implemented the map fragment inside a fragment. I would like to show pins on the map. I know the simple way of putting the marker on the map is easy.
However in my app I have to save all their information I have to use,two different pins , for example for girls the icon would be pink and for boys the pin would be blue.
Now I want to put some other information for example the id, name and status, age, game, latitude and longitude and so on. I do not want to show all of this information when user click the pins. I want to show the information in a new activity which would get open user click.
Please help me, how can I share the information of each marker completely and then, when the user clicks the marker the new activity should open and show related information. I have searched many tutorials on this topic prior to posting my question.
This should be useful http://googlemaps.github.io/android-maps-utils/
It has:
Marker clustering — handles the display of a large number of points
Heat maps — display a large number of points as a heat map
IconGenerator — display text on your Markers (see screenshot)
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