Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8187973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:44:49+00:00 2026-06-07T02:44:49+00:00

Ok, so I am trying to write a code which returns back the values

  • 0

Ok, so I am trying to write a code which returns back the values of all the 4 corner position of the map according to current view able area. For example, a user access Google maps through his device, he focuses on a particular area and hits a button and gets back the position (latitude and longitude) of all the four corners.

For this I have the center coordinate and now all I want span of the current viewable area and get the top left and bottom right corner coordinates. for this I used,

Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x; // returns 480
int height = size.y; // returns 800

Now I want to convert them into latitude and longitude values so that I can use simple math such as:

topLeftLat= centerLat + lat/2;
topLeftLon= centerLon - lng/2;
bottomRightLat= centerLat - lat/2;
bottomRightLon = CenterLon + lng/2;

This would give me the corner cordinates.
lat and lng being the converted sceen resolution in latitude and longtiude values.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T02:44:51+00:00Added an answer on June 7, 2026 at 2:44 am

    This took 5 minutes search on google so I don’t know why I’m giving you this … learning to research is the biggest part of being a developer.

    GeoPoint mapCenter = myMap.getMapCenter();
    
       float centerLatitude = (float)(mapCenter.getLatitudeE6())/1000000;
       float centerLongitude = (float)(mapCenter.getLongitudeE6())/1000000;
    
       float latitudeSpan = (float)(myMap.getLatitudeSpan())/1000000;
       float longitudeSpan = (float)(myMap.getLongitudeSpan()/1000000);
    
       GeoPoint mapTopLeft = myMap.getProjection().fromPixels(0, 0);
       float topLatitude = (float)(mapTopLeft.getLatitudeE6())/1000000;
       float leftLongitude = (float)(mapTopLeft.getLongitudeE6())/1000000;
    
       GeoPoint mapBottomRight
       = myMap.getProjection().fromPixels(myMap.getWidth(), myMap.getHeight());
       float bottomLatitude = (float)(mapBottomRight.getLatitudeE6())/1000000;
       float rightLongitude = (float)(mapBottomRight.getLongitudeE6())/1000000;
    
    String info =
         "Center: " + centerLatitude + "/" + centerLongitude + "\n"
         + "Top Left: " + topLatitude + "/" + leftLongitude + "\n"
         + "Bottom Right: " + bottomLatitude + "/" + rightLongitude + "\n"
         + "latitudeSpan: " + latitudeSpan + "\n"
         + "longitudeSpan: " + longitudeSpan + "\n";
    
       Toast.makeText(AndroidMapActivity.this,
         info,
         Toast.LENGTH_LONG).show();
      }};
    

    The full tutorial is available at Android-er: Get the the coordinates (Latitude and Longitude) currently displayed on MapView

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While trying to write code which returns 24 hours less than a given time,
I'm trying to write a code which, given a path to an item in
I'm trying to write a code which stores strings in an array. I'm trying
I am trying to write some simple code which will read a text file
I'm trying to write some C code which is portable only so far as
I'm trying to write a piece of code which use the user choice in
I'm trying to write some Haskell code in which there are multiple data types,
I am trying to write some code that that will draw the line which
I'm trying to write some C++ code for Windows 7 which will connect to
I have been trying to write a delegate to a view controller which has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.