Hotspot markers in Google Streetview - android

I am building an android app and I am trying to figure out a way to place custom markers in Google Streetview, something like hotspots that display images when clicked and move along with the camera so that they go off screen if necessary. I have no experience at all, so I would at least understand where to start studying.
Would it be possible with CSS position properties?
Edit: I am searching for a way to locate them in street view mode, not in map mode.

Marco! Work with markers is very simple. For drag-drop marker you should override methods onMarkerDragStart, onMarkerDrag, onMarkerDragEnd. All click on marker call infoWindow. So, you can set your InfoWindowAdapter to map and implement your code logical here.
For concurrent moving camera with marker (right me understand?). Unlike ios version of google map, you can catch only final position of your camera (analoge idleCameraPosition on ios). So, i think you have to move marker first, and after it set camera to marker position
The best way to understand simple things of android google map is https://developers.google.com/maps/documentation/android-api/signup

Related

Arrow direction header pointer in google map marker for Android

I am using Google map v2,everything works fine from viewing the map to applying polyline between markers.However there is one thing that I need to accomplish, it is to put arrow header inside the commonly used map marker.
The arrow must rotate or point to the direction of the next location and so on. here's the image looks like
map_marker
I have tried using only the arrow alone and it works fine with the use of .rotation(bearing) but my boss wants it inside the commonly used marker and only the arrow will move.They have a working sample but it works only in the browser using javascript.I haven't found samples or at least documentation about it on the internet only this similar question
How to display direction arrows in the map marker for google maps v2 android but unfortunately no one answered. I have also tried
.icon(BitmapDescriptorFactory.fromBitmap(getMarkerBitmapFromView(R.drawable.arrow_header)))
but the both the marker and arrow moves
I have done everything to accomplish this task and this would be my last resort just to inform my boss that just in case there is no way that it'll work on android. Thank you..

How to know if markers on the map touch each other

I am building an application which uses Google Maps. When displaying the map, I'm also adding markers. Is there a way to see if there are 2 markers that touch each other, meaning if a part of a marker is on top of another marker? My goal is to be able to find that out and then make them a single bigger marker instead of 2 different markers.
The answer should depend somehow on the marker's icon size and the current map zoom since if I zoom out, there's a bigger chance they might overlap.
There seem to be a library made by Google which clusters a set of markers together automatically when they are close to one another.
The library is the marker clustering utility and instruction can be found here:
https://developers.google.com/maps/documentation/android-api/utility/marker-clustering

How to make a Custom marker on google maps disappear if it is not in focus

Some of the markers in google maps appear when zoomed in. However, when a user drag the map into a different place, the marker disappears, and when you drag it again on the previous place, the marker starts to animate in front of you (I hope you are getting what I'm trying to say). I want to know if there is such a way to do that. Thanks.
The same thing happens in Google Maps Android API v2 on street names, parks, etc.
There is no support for marker transparency as of this writing. You will have to code it yourself: posting to Handler until the animation finishes and setting new icon every "frame" with increasing opacity.

Android - Dragging marker without having to hold in map api v2

I'm implementing a feature in my app that allows user to manually locate themselves on a map. So I use a pin to represent their location and let user drag it to the place they currently are. The simple solution is to use setDraggable(true) on the marker, but this requires users to hold the marker for 3 or 5 seconds until it is draggable. I think this is quite confusing for many user to use the feature. So, what I want is to make the dragging more responsive by letting users drag them immediately without having to hold it for a while - like how Foursquare does!
What should I do to implement my own dragging feature? If you have any suggestions, please help me and thanks.
Check out the Hailo application. They have a neat workaround for this. It only works when you have one marker to drag.
The trick is to pan the map, instead of moving the marker. They just keep the marker in a view on top of the MapFragment (it's not actually a Marker on the map).
You can then use the map's cameraPosition.target as the location of your marker.

Android custom GPS map application

I want to build an app that uses GPS data and a building map I provide to show the user where in the building on the map they are. This will be done in a specific building that i already know gets GPS and cell service.
At first I thought the easiest way to do this was to see if I could use Google maps to plot the users location and then just "overlay" my custom building map on top of the Google map so that I wouldnt have to deal with any of the gps information or the complexities of the mapping I would just have to scale my "overlay" to fit properly on top of the Google map so that the user was shown in the correct room in a building. I'm wondering if anyone can provide me any information on how to do this or if there is an easier way to accomplish my map. Any information at all is helpful!
You want...
Google Map View
...and more specifically you will probably want to read the subsection appropriately titled: "Part 2: Adding Overlay Items"
EDIT: Whoops! Nevermind! I misread your question... that is only if you want to overlay an item on the map. Sorry...
There is no possibility to use closer zoom level than that you can see on standard GMap i.e. in browser. Other problem is that google uses GeoPoint class based on cardinal microdegrees to draw overlays, and it's accuracy is to low.
You can look on jGarminImg - it's java library - unfortunately written for using with swing, but it should be relatively easy to make it work with android. On the other hand - you have to make your own map.
You can use standard overlays, or you can make your map in kml format and use this example to display it.
You may be able to achieve this with a custom view that displays your building plan and knows the precise co-ordinates of each corner of the building.
When you receive your location updates you can add a marker to your custom view by translating the real world position into a position in the image using something along the lines of:
pseudocode:
markerX = realWorldX - mapStartX;
markerY = realWorldY - mapStartY;
if( isOnMap( markerX, markerY ) )
{
drawMarker( markerX, markerY );
}
Yes you can overlay bitmap images on top of the Google MapView.
All you have to do is subclass the Overlay class, override the draw method, and draw on the canvas. You have to provide a rectangle of GeoPoints (probably the top left and the bottom right corners) to anchor the building bitmap on top of the MapView. You use mapView.getProjection() to translate the latitude and longitude into xy coordinates on the canvas.
I assume drawBitmap(Bitmap bitmap, Rect src, RectF dst, Paint paint) will be useful here. Bear in mind that src and paint can be null. If the GeoPoints you used are accurate, the bitmap will adjust automatically to pans and zooms, although it might get pixelated if the user zooms in too much.
edit: I am not so confident that Google Maps will have your building stays at the exact same GeoPoints in different zoom levels, so you might have to adjust those values for different zoom levels
If you need only the map of the building, it should not be too difficult to plot the location on an image without using Google Maps, provided that you can determine your location as coordinates inside the building.
You need to know two coordinates: north-west and south-east corners of the building map you are using. When you get GPS location updates, the correct location on the map image can be easily calculated based on these corner coordinates.
I would do it like this,
Place a marker on the google map to indicate the position of the building
Drilling down on the building would load your building map as a custom view. Plot the user location on the custom view
I think trying to overlay your building map on a google map while possible will be more complex to code than doing it via a custom view.
Also overlaying the lowest zoom level with your building map is not going to give you enough resolution unless you have a thumping big building. Whole blocks are pretty small
One issue you have probably already considered is the device will revert to cell tower and wifi for it's location when inside the building giving you a less accurate location fix.

Categories

Resources