How can I create a custom interface in Google Maps - android

I have a project to develop a application to get a direction in Google Maps.
Now, I can draw a direction with GeoPoints (latitude and longitude) in map. But, I want my application can let the user enter locations (from and to location) (1). So, I want to create a custom interface base on available Google Maps' interface (2).
I need your intructions in step (1) and (2).
I'm very grateful for any help you can provide.

You just can define a pair of EditText components in the layout instead of filling it with a MapView.
You know that you can paint whatever you want, not only markers, by means of OverlayItems as described in the own Google tutorial or in this other tutorial about using overlays, on top of a MapView.

Related

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

Hotspot markers in Google Streetview

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

modify polygon in android google map api

I started Google map in android few days age. I am doing some basic things like set marker on tap, draw line between two marker etc.
Here users can draw polygon with tapping on the device. Now i want to edit the shape. I goggled it but didn't find any helpful solution for android.
I found some resource on google map java script API like user-editable-shapes in javascript
I want to do the same in android. How to Edit or Modify polygon in Google Map Android API
It will be helpful if u provide some resource.
It looks to me like you have to replace all the points at once with setPoints on the polygon object.
https://developers.google.com/android/reference/com/google/android/gms/maps/model/Polygon.html#setPoints(java.util.List)
I'm currently trying to do the same thing in Xamarin. I mock up an edit mode when the user clicks on the polygon by changing its stroke color and then adding custom markers to each vertex. I'm holding a selected vertex which will move to the user's next click on the map and update the polygon.

Dynamically hide/show markers when indoor maps floor changed in android

I am creating one google indoor map application as a part of my project. As of now i just try to create some working prototype before main application gets starts. As of now i am using one college location where i can find indoor maps available.
My main goal is show markers with windowInfo on different floors locations like rooms, theater or auditorium. I just used 1st floor one room lat long and set marker as of now. But when user switch to second floor then map should hide first floor marker and have to show other available markers on floor 2. Same thing would apply for all other floor levels.
Here, my main problem is that how can i get to know exact lat long or location of particular place on floor 2 where i should have to show marker point. Is there any way where google give response of upper floor locations with lat long or some height so i can try to determine that and show marker.
Second confusion is that when user zoom in or out or else user changes floor level at that how we can handle a lot markers hide and show.
Please share your ideas and views on this. As of now i can able to put marker on only first floor. you may find that image below.
Any help would be really appreciated.
you can use getLevels ()
Gets the levels in the building. While a level is usually enclosed by a single building, a level might be enclosed by several buildings (e.g., a carpark level might span multiple buildings). The levels are in 'display order' from top to bottom.
You can also use various methods in IndoorBuilding class getActiveLevelIndex(), getDefaultLevelIndex(),isUnderground() etc
Read more about IndoorLevel
Hope it helps
Some apps include your altitude along with your the lat/long information. What you need to do is to get your altitude and keep that as a variable. Then find out what altitude each of the levels of the building are. I am attempting to do the same thing for a University and that is the only way I knew of where you could know that you are on a second or third floor. Think of it as having your x,y, and z values. Lat/Long is basically a 2d representation of the earth's surface. But, you also have a 3rd plane. You could do the following: Download a program that not only tells you your lat/long but, also the altitude. Then have a variable that is a constant for each building. (building name) (Floor number) (Floor elevation). Then when you give the building lat/long you also give the elevation variable and then it associates it with a floor number.
Ashe

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