If you check the Google Maps application for Android, there are 3 modes available to display the listview. One of the modes available in Google Maps is the tilt mode wherein the map is displayed in 3D. The map also rotates when the user changes his direction.
How can I achieve this functionality?
If you're referring to an Android MapView allowing you to do that, you currently do not have those capabilities available via the SDK.
You should use accelerometer/gyroscope to achieve that.
please check out Sensor Manager and its examples!
Related
I am very new to android, and I basically have almost no experience. Recently my client got an idea where he wants to have a custom map (in .png/.jpg/.jpeg format) on which, using GPS only, will be displayed his location using a marker, and location where he is supposed to get. Those two markers have to be connected with a "path", that will be like some sort of navigation from one marker to another. One of the requests is that it must be done without any usage of Google maps. My question here is - is that even possible to be done like this?
The only idea that I got is to get coordinate from GPS, make a proportion pixels on the image to coordinates and put a marker on where the user is supposed to be. Is there a better option than this?
I think you can try out this method in the below link.
Which can turn your images into interactive map layers that can be displayed in websites, used in mobile phones, tablets, GPS devices, map mashups or opened in the desktop GIS software, Google Maps or Google Earth.
http://www.maptiler.com/
I am writing a navigation app and I require rotation of the camera around the user (So rather than just rotating the user icon with the compass the camera rotates around the user giving the impression that the map is rotating in accordance to real life.)
I couldn't seem to find a default mode to do this I have tried the bearing tracking modes (GPS and Compass) as well as the location tracking modes:
mapboxMap.getTrackingSettings().setMyLocationTrackingMode(MyLocationTracking.TRACKING_FOLLOW);
As I was unable to get it working I implemented a custom compass with a basic low pass filter in order to rotate the camera around the user. However as of upgrading from Mapbox 4.1.1 to 4.2.1 my custom implementation has broken (Rotation has become very laggy and very jagged).
I am sure there is a much easier way to do this but I am having a bit of trouble figuring it out. Could someone please advise me as to whether I was going about it the correct way or if there is a much easier solution that I am looking over?
Thank you in advanced!
To track the user location and rotate the map to the orientation is always pointing in the same direction as the user, use these lines combined:
mapboxMap.getTrackingSettings().setMyLocationTrackingMode(MyLocationTracking.TRACKING_FOLLOW);
mapboxMap.getTrackingSettings().setMyBearingTrackingMode(MyBearingTracking.COMPASS);
Note for the full code, i'd recommend checking out this example.
Yes as #SCTaylor says, you absolutely need .setDismissAllTrackingOnGesture(false) to make this work
I started developing an app using HERE api. Basically I have to navigate from one point to another using HERE sdk offline as well as online. Also I have to be able to rotate the map according to orientation of the mobile as we navigate, while showing the remaining distance to be covered in real-time. Next, I have to integrate a compass with the HERE map so compass tells the direction in which user is moving.
Here are full working Android projects for all of your tasks using the HERE MobileSDK for Android:
Basic Map application: https://tcs.ext.here.com/sdk_examples/BasicMapSolutionGradle.zip
Positioning, Routing and turn by turn voice guidance:
https://tcs.ext.here.com/sdk_examples/TtsAndNavigation.zip
Compass and custom position marker rotating to compass north:
https://tcs.ext.here.com/sdk_examples/CustomPositionMarker.zip
What you want to achieve is possible with the Premium SDK variant of the HERE Mobile SDK as offline support is not available in the Starter SDK.
However, integrating a compass is possible using the Starter edition: You can use the CustomPositionMarker example (https://tcs.ext.here.com/sdk_examples/CustomPositionMarker.zip) with a few modifications since it was build for Premium SDK:
Remove LocalMesh, MapLocalModel, MapOverlayType since these are suitable only for 3D Vector Maps which are not available in starter edition.
Rotate the map according to current yaw like shown here. Place this code inside the onSensorChanged()-callback of Android's SensorEventListener (as shown by the example). This will rotate the map according to the sensor's azimuth.
To render a compass needle or just a map center circle use for example HERE's
MapCircle (double radius, GeoCoordinate center). Note that the constructor takes different arguments in the starter edition of the SDK.
In the official Google Maps application when a user rotates the device, StreetView is rotated. I made a research and didn't find how to enable gyroscope functionality in Google Maps v2 API for StreetView. I can implement this by myself, but maybe there IS such functionality and I just haven't find it?
There isn't any built-in features in StreetView to enable this functionality. If you would like to do it by yourself you can check following links:
Set the camera orientation point of view
Animate the camera movements
It looks like Google recently updated their API to include accelerometer-based tracking in the street view point of view. Try this example on your phone.
From the documentation on Motion tracking on mobile devices:
On devices that support device orientation events, the API offers users the ability to change the Street View point of view based on the movement of the device. Users can look around by moving their devices. This is called motion tracking or device rotation tracking.
More information (like how to disable it) is in that link.
We are developing an indoor application on iOS and Android using MapKit and Cloudmade for the mapping.
The mapping we have should be able to work both online and offline. My mapping expect is having troubles on how to make the map rotate to face the same way the user is facing.
So we are able to do real-time tracking and display it on a pre-plotted route on the map, but we need to have the direction the person is walking as displayed on the map to face the same direction the user is facing.
How can we do this ?
The technique and Android SDK sample for Google maps described below also works for osmdroid.
Rotate MapView in Android