[Gdal-dev] Latitude view thinner than it should be

Josepo Urrutia find_all at hotmail.com
Tue Sep 27 10:40:57 EDT 2005


First of all, thanks for this awesome library ( it saved me a lot of hard 
work and time ;-) ).

The bad news are that I've some "little" question about the use of the 
library (stupid newbee question surely), that I'd post in different threads.

Let's start with the first one:

Using the GDAL/OGR library I've manage to import a S-57 map into a 
OGRDataSource, that is used to get access to the diferent OGRLayers and 
OGRFeatures.

With this information I visualize the map onto the screen.

To get access to the lat/lon data of the map (the initial and final latitude 
and longitude) I do a search to all the OGRFeatures and ORGGeometry of those 
features to look for the maximum and minimum. Is there a more direct way to 
get this inf.?

Then to calculate the pixel on the screen that represents a position I use 
this simple formule:

	// Knowing the initial/final lon and the screen weigth
	// we calculate the number of screen pixel for 1 longitude grade
	pixel_per_lon_grade=(winw/(lon_end-lon_ini));

	// lat_data and lon_data is the position we want to transform
	// pixel_y and pixel_x is the resulting screen position
	pixel_y=(lat_ini-lat_data)*pixel_per_lon_grade;
	pixel_x=(lon_ini-lon_data)*pixel_per_lon_grade;

The problems of using this formule is that the latitude view gets thinner 
than it should be.

Obviously I'm forgetting something important (I told you I was a newbee with 
topographical maps, didn't I?), any ideas or suggestions?


I'm using GDAL/OGR 1.3.0 on a RHEL 4 system.





More information about the Gdal-dev mailing list