Search code examples
androidgoogle-mapslocationshapesdirection

Android getting points of a specific direction in some meters in google map


I am able to get current direction when i walk. What i try to make is drawing an arc or quarter circle to my direction and getting edge points of my circle.

Actually i am trying to get 3 points. I am able to get my current location. The other 2 locations are the edge points of my arc in my direction. It is not a must drawing arc or circle to my direction. Maybe drawing polygon is acceptable for me.

Can you help me to find out a solution on this ?

Thanks,


Solution

  • Maybe you can start reading the documentation of Shapes in the Google Maps Android API, it explains here some simple ways to add shapes to your maps in order to customize them for your application.

    • Polyline is a series of connected line segments that can form any shape you want and can be used to mark paths and routes on the map.

    The Polyline class defines a set of connected line segments on the map. It also consists of a set of LatLng locations, and creates a series of line segments that connect those locations in an ordered sequence. Just check the this link on how to create Polylines

    • Polygon is an object that are similar to Polyline objects in that they consist of a series of coordinates in an ordered sequence. However, instead of being open-ended, polygons are designed to define regions within a closed loop with the interior filled in. You can add a Polygon to the map in the same way as you add a Polyline.

    • Circles is a geographically accurate projection of a circle on the Earth's surface drawn on the map.

    The following code snippet adds a circle to the map by constructing a CircleOptions object and calling GoogleMap.addCircle(CircleOptions):

    // Instantiates a new CircleOptions object and defines the center and radius
    CircleOptions circleOptions = new CircleOptions()
        .center(new LatLng(37.4, -122.1))
        .radius(1000)); // In meters
    
    // Get back the mutable Circle
    Circle circle = myMap.addCircle(circleOptions);
    

    For more sample code check the documentation and this link.