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 654933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:32:53+00:00 2026-05-13T22:32:53+00:00

I m having little trouble finding a relation between the movement at centre and

  • 0

Im having little trouble finding a relation between the movement at centre and edge of a circle, Im doing for panning world map,my map extent is 180,89:-180,-89, my map pans by adding change(dx,dY) to its extents and not its centre. Now a situation has arrrised where I have to move the map to a specific centre, to calculate the change in longitudes is very easy and simple, but its the change in lattitudes that has caused problem. It seems the change in centreY of map is more than the change at edge of the mapY, or simply if I have to move the map centre from 0long,0lat to 73long,33lat, for dX I simply get 73, but for dY apparently it looks 33 but if i add 33 to top of map that is 89 , it will be 122 which is incorrect since Latitudes are between 90 and -90 . It seems a case a projection of a circle on 2D plane where the edge of circle since is moving backward due to angle expereinces less change and the centre expereinces more change, now is there a relation between these two factors? I tried converting the difference between OriginY and destinationY into radians and then add to Top and Bottom of Map, but it did’nt really work for me. Please note that the map is project on a virtual canvas whose width starts from 256 and increases by 256*2^z , z=0 is default and whole world is visible at that extent of canvas

public void moveMapTo(double destinationLongitude,double destinationLattitude) // moves map to the new centre
        {
            double dXLong=destinationLongitude-centreLongitude; // centreLongitude and centreLattitude are centre of current map position
            double atanhsinO = atanh(Math.sin(destinationLattitude * Math.PI / 180.00));
            double atanhsinD = atanh(Math.sin(centreLatitude * Math.PI / 180.00));
            double atanhCentre = (atanhsinD + atanhsinO) / 2;
            double latitudeSpan =destinationLattitude - centreLatitude;
            double radianOfCentreLatitude = Math.atan(Math.sinh(atanhCentre));
            double dXLat=latitudeSpan / Math.cos(radianOfCentreLatitude);
            dXLat*=getLattitudeSpan()*(Math.PI/180); //<--- HERE IS THE PORBLEM

            System.out.println("dxLong:"+dXLong+"_dxLat:"+dXLat);
    //map left.right.top,bottom are current extents of map
            mapLeft+=dXLong;
            mapRight+=dXLong;
                         mapTop+=dXLat;
            mapBottom+=dXLat;




    }
    private double getLattitudeSpan()
    {

            double latitudeSpan = mapTop - mapBottom;
            latitudeSpan = latitudeSpan / Math.cos(radianOfCentreLatitude);
            return Math.abs(latitudeSpan);

    } 
  • 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-05-13T22:32:53+00:00Added an answer on May 13, 2026 at 10:32 pm

    I solved a similar problem a while back and may be able to give you some hints.

    Panning in all 4 directions by adding a scaled longitude or latitude only works for a Mercator projection; is this what you have? If so, good.

    To pan north and south, I think the only thing you can do is show a white (empty) background north of the pole if you’ve panned north; i.e. you show less of the map.

    To pan east and west, you have to replace the part of the world that’s gone offscreen with the wrapped-around edge of the opposite side.

    I’ve found that my code becomes very simple if I create a map like this:

    ws ws ws ws ws ws ws ws
    eu po PO NA EU PO po na
    af po PO SA AF PO po sa
    ws ws ws ws ws ws ws ws
    

    The central part, in uppercase letters, is your original world map: NA, SA, EU and AF stand for North America, South America, Europe and Africa, respectively (grossly simplified map here). PO is the Pacific Ocean. Around that original map I’ve stitched another copy of the map horizontally and white space (ws) vertically.

    Initially, your view is centered at 0/0, i.e. between NA/SA and EU/AF, and clipped to show you 90° north and south and east and west from there, for a total of 180° in both directions. From there, you can pan up to 180° east or west and still see the same amount of the world. You can, for example pan 180° east to the International Date Line (in the Pacific) and see Europe and Africa to the left and North/South America on the right.

    You can also pan up and down by 90°. Since wrapping around wouldn’t make any sense here, part of your view will then be white space.

    The downside to this is that your map image will be about twice as big in compressed file size and four times as big in pixel size. You could achieve the same effect by stitching in code, but using the super-sized world map is a fair bit easier.

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

Sidebar

Ask A Question

Stats

  • Questions 351k
  • Answers 351k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Something like.. set the control parameter to -1 then in… May 14, 2026 at 7:10 am
  • Editorial Team
    Editorial Team added an answer I think your best choice would be to use Click… May 14, 2026 at 7:10 am
  • Editorial Team
    Editorial Team added an answer Found it, got to implement a custom validator per Grails… May 14, 2026 at 7:10 am

Related Questions

I need to run a simple script after the modules and programs have been
NSMutableDictionary *bookmarks = [NSMutableDictionary dictionary]; [bookmarks setObject:[NSURL URLWithString:(NSString *) @http://stanford.edu] forKey: @Stanford University]; [bookmarks
I'm having a little trouble figuring out a fast way to accomplish a (seemingly)
I'm trying to make use of OpenID to allow me to login to my
A friend of mine was talking about a word game she liked to play

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.