# How to find relation between change in latitudes at centre of map and top/bottom

Filed under:
|
|
|
##### trigonometry

Hi,

I`m having little trouble finding a relation between the movement at centre and edge of a circle, I`m 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

code: public void moveMapTo(double destinationLongitude,double destinationLattitude) // moves map to the new centre { double dXLong=destinationLongitude-centreLongitude; 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);

mapLeft+=dXLong;
mapRight+=dXLong;
mapTop+=dXLat;
mapBottom+=dXLat;
``````

} ////latitude span function private double getLattitudeSpan() {

``````    double latitudeSpan = mapTop - mapBottom;
return Math.abs(latitudeSpan);

} //ht
``````

© Stack Overflow or respective owner

• #### java gis library

as seen on Stack Overflow - Search for 'Stack Overflow'
What is the best/user friendly GIS/arcGIS Java library for basic academic assignment? >>> More

• #### Grails GIS Application

as seen on Stack Overflow - Search for 'Stack Overflow'
Hello, I'm working on an internal IT application monitoring outages for a network with a national footprint in the US. I'm considering overlaying outages by region on a map. Showing outage areas in red for example. The user clicks on the outage area displaying drill down information. The technology… >>> More

• #### Open source GIS tools

as seen on Stack Overflow - Search for 'Stack Overflow'
Hi I’ve been looking at Open Source GIS tools. In particular MapServer and GeoServer. The problem I’m seeing is that to actually deploy these to the public you can’t use a regular \$5/ month (or free) hosting service because you have to install these services on the server in ways that are not accessible… >>> More

• #### Distance Between GIS Points

as seen on Stack Overflow - Search for 'Stack Overflow'
I have a large number of GIS (latitude, longitude) coordinates, and I'd like to get the distance between them. Is there a service that will calculate the shortest path for me? I know about google maps, but I'd like something I can use from Python, and that can handle a large batch of requests at once… >>> More

• #### Working with Spatial Data Part IV - Developing a Geospatial Dashboard (GIS)

as seen on SQL Server Performance - Search for 'SQL Server Performance'
This article leverages the examples and concepts explained in the third part of this spatial data series which develops a "BI-Satellite" app ( Reporting spatial data with SSRS 2008 R2 and Reports Builder 3.0 Part-III ... [Read Full Article] >>> More

• #### Vertex buffer acting strange? [on hold]

as seen on Game Development - Search for 'Game Development'
I'm having a strange problem, and I don't know what could be causing it. My current code is identical to how I've done this before. I'm trying to render a rectangle using VBO and orthographic projection.   My results:     What I expect: 3x3 rectangle in the top left corner   #include <stdio… >>> More

• #### Plane projection and scale causing bluring in silverlight

as seen on Stack Overflow - Search for 'Stack Overflow'
Ok, So I've tried to make an application which relies on images being scaled by an individual factor. These images are then able to be turned over, but the use of an animation working on the ProjectionPlane rotation. The problem comes around when an image is both scaled and rotated. For some reason… >>> More

• #### Map tiling - What kind of projection?

as seen on Stack Overflow - Search for 'Stack Overflow'
Hi. I've taken a large image and divided it in to square tiles (256x256). It is made for google maps also, so the whole image is divided into z_x_y.png (Depending on zoom level). z=0 = 1x1 tile z=1 = 2x2 tilesthe z=2 = 4x4 tiles My imageMap is "flat" and is not based on a sphere like the worldmap… >>> More

• #### Projector Review: HP Notebook Projection Companion

as seen on Internet.com - Search for 'Internet.com'
Got PowerPoints? HP's under-one-pound, palm-sized projector is a computer peripheral that stands out in a crowd, or a conference room. >>> More

• #### Camera for 2.5D Game

as seen on Game Development - Search for 'Game Development'
I'm hoping someone can explain this to me like I'm 5, because I've been struggling with this for hours and simply cannot understand what I'm doing wrong. I've written a Camera class for my 2.5D game. The intention is to support world and screen spaces like this: The camera is the black thing on… >>> More