[Mapnik-users] Displaying a bounding box according to kilometers instead of degrees

Anisha Kaul anisha.kaul at hitechroboticsystemz.com
Mon Apr 12 12:23:38 CEST 2010


Hello again,

I am able to successfully display a bounding box on the map given some latitude/longitude values.

Now I want to display the bounding box according to kilometers. 
i.e. Let there be a point on the map according to some given latitude/longitude values, I want to display an area of 5 kilometers on 
the map while keeping that point as center.

The method I tried is presented below:
(Below currently I have not used any center point but I have tried to display the bounding box in *meters*)

[code]
        projection e ("+proj=latlong +datum=WGS84 +lat_ts=0 +lon_0=0");
	
	double latA  = 70.18722200000001;
	double lonA = 20.671857388281254;
		
	e.forward (latA, lonA);
	
	double latB  = 95.4028777;
	double lonB = 35.90895391171875;
	
	e.forward (latB, lonB);
	
	m.zoomToBox (Envelope <double> (latA, lonA, latB, lonB));
[/code]

There being no documentation w.r.t the functioning of *forward ()*  function of projection class, all I could assume after reading 
the *man pj_fwd* is that the *forward ()* function reads latitude and  longitude  values in decimal degrees, and prints the projected 
cartesian values in "meters".

How should I use the forward() function to achieve above task ?
Whats wrong with the above code (The bounding box is not changing if I comment out the projection functions in the above code) ?

Kindly guide !


Regards,
Anisha Kaul

-------------------------------------
Hi-Tech Gears Limited, Gurgaon, India







More information about the Mapnik-users mailing list