I'll start with adding a marker at the center of the map (target). I'll round the coordinates to the closest three-decimal number (36.2123321->36.212). The marker will be updated every time the map moves.
There will also be an arbitrary number of markers representing the existing directions from the current origin coordinate. Those markers will appear and disappear, depending on the current location.
A snippet will show the best distance/duration and an icon will show the best mode of transport
A snippet will show the best distance/duration and an icon will show the best mode of transport
Single Marker
It's easier to implement the single marker, so I'll start with that one for now.
The first step is to simply add the marker at the center of the map. After changing the icon of the marker is now changed in two steps:
Step 1: Add an icon to the resource file |
Step2: Let the marker object point to the icon resource |
To make the marker update when the user moves the map, I made a small change in the onCameraMove listener in the map object.
The code rounds the coordinates to the closest 3rd decimal. |
The purpose of this is to reduce the number of possible coordinates. Otherwise, I'd have zillions of coordinates in the database, many of them only feet apart.
No comments:
Post a Comment