[Mapbender-dev] Regarding Scale calculation for non-metric SRS

Abhishek Singh singhabhishek.bit at gmail.com
Fri May 14 15:17:46 EDT 2010


Hi,

I am currently working on Scale Calculation for Non-metric SRS, I went
through the manual link at
http://www.mapbender.org/User_talk:Abhishek#Scale_calculation_for_non-metric_SRS.
I had implemented that in c++

#include<iostream>
using namespace std;

#define PI 3.1416
#define radius 6378137
#define standard 0.00028

int main()
{
    float xa_length;
    float ya_length;
    float x_pixels;
    float y_pixels;
    float std_scale_dr;
    cout<<"Enter the xa_length(angular units): ";
    cin>>xa_length;
    cout<<"Enter the ya_length(angular units): ";
    cin>>ya_length;
    float xl_length;
    float yl_length;
    cout<<"Considering standardized rendering pixel size to be 0.28mm ×
0.28mm (millimeters) "<<endl;
    cout<<"and radius of earth = 6378137m "<<endl;
    xl_length = (xa_length * (2 * PI * radius))/360;
    yl_length = (ya_length * (2 *PI * radius ))/360;
    cout<<"map extent is : " << xl_length << "m  x " <<yl_length<<" m
"<<endl;
    cout<<" Enter the x_pixels (no. of pixels on horizontal axis) ";
    cin>>x_pixels;
    cout<<" Enter the y_pixels (no. of pixels on vertical axis) ";
    cin>>y_pixels;
    std_scale_dr = ((xl_length / x_pixels)/ standard);
    cout<<"standard scale denominator will be : "<< std_scale_dr<<endl;
    return 0;
    }

Now the next step for me is to understand what is going on in file
mapbender/http/javascripts/map_obj.js in the functions getScale , checkScale
and repaintScale and thereafter implement the above sample code's
functionality in the aforesaid file.

But currently I am having problem with getScale function variables.I am
stating some of my questions below:

1 .  why is lat_from = ((parseFloat(bbox[3]) - parseFloat(bbox[1]) / 2) *
Math.PI) / 180

2 .  why actually we are dividing by 2 parseFloat(bbox[1])

3 .  Please explain the underlying reason for this var lat_to =
((parseFloat(bbox[3]) - parseFloat(bbox[1]) / 2 + pxLeny) * Math.PI) / 180;

4 . Even though the number of longitudes is twice the number of latitudes
but still the formula for both of them are the same

5 . Please explain dist = 6371229 * Math.acos(Math.sin(lat_from) *
Math.sin(lat_to) + Math.cos(lat_from) * Math.cos(lat_to) * Math.cos(lon_from
- lon_to))

6 . what does mb_resolution and scale refer to? please explain the
expression scale = (dist / Math.SQRT2) * (mb_resolution * 100)

7 . please explain  xtenty = parseFloat(bbox[3]) - parseFloat(bbox[1]) and
scale = (xtenty / this.getHeight()) * (mb_resolution * 100)


Thanks,

Abhishek Kumar Singh
BE/1349/2007
Information Technology
6th SEMESTER
BIT MESRA
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapbender_dev/attachments/20100515/40cd87ba/attachment.html


More information about the Mapbender_dev mailing list