Jeongbebs
Jeongbebs

Reputation: 4120

How can I trigger the Several Functionality of Google Maps in my App

I am trying to create a maps app for a certain city that have some stored latitude and longitude for certain landmarks in the city. In the map,

I've already tried a GPS program from androidhive that detects your lat and long coordinates. I'm also trying to understand how to acquire and use the google maps api. I would like to know the possible approaches in doing it since I'm still new to android.

Thanks in Advance!

Upvotes: 0

Views: 229

Answers (1)

Shivang Trivedi
Shivang Trivedi

Reputation: 2182

you can zoom with specific mile or kmeter by this code:this is for two mile:

    Display display = getWindowManager().getDefaultDisplay();

    // double equatorLength = 3218; // in meters
    double equatorLength = 40075004; // in meters
    double widthInPixels = display.getWidth();
    double metersPerPixel = equatorLength / 256;
    int zoomLevel = 1;
    // 2 mile=3218 mtr
    while ((metersPerPixel * widthInPixels) > 3218) {
        metersPerPixel /= 2;
        ++zoomLevel;
    }

    return zoomLevel;

hope this is helpfull for "you can only zoom in and zoom out within the boundaries of the city"

Upvotes: 1

Related Questions