converting from degrees to meters using cs2cs

Frank Warmerdam warmerdam at POBOX.COM
Tue Sep 5 21:15:50 EDT 2006


Ryan Ollerenshaw wrote:
> I want to convert from longlat coordinates to lcc but i keep getting the 
> following error:
> 
> Given map extent is invalid. Check that it is in the form: minx, miny, 
> maxx, maxy
> 
> To get my new map extent i am using:
> 
>  >cs2cs    +proj=longlat +a=3396190 +rf=169.8944476026241 +lon_0=0 
> +no_defs            +to
>            +proj=lcc +a=3396190 +b=3396190 +units=m
> 
> -179 -89
> -120680927.21   57506773.12 -19983.82
> 179 89
> 310182.75       6770294.70 -19983.82
> 
> i am then setting my extent to: -120680927.21 57506773.12 310182.75 
> 6770294.70
> 
> what could i be doing wrong? and why does cs2cs return * when i use 180 
> or 90 as my input parameters?
> 
> I hope that was clear, that you for any help that you can provide.

Ryan,

Some projections cannot be used with any location on the earth - either
due to numerical inaccuracy as you venture far from the origin, or because
some areas of the earth are "over the horizon" or otherwise not in the
domain (range?) of the function.

In this case the value for -179,-89 clearly has a crazy Y value.  57
million meters is greater than the circumference of the earth (roughly
40 million meters).  So, I think you are just going to have to pick a
more appropriate region to start with.

All that aside, if you look at your extents, the so called minimum
is around 57 million compared to 6.7 million for the maximum y.  So
MapServer is complaining because "min y" is greater than "max y".

If you are confident you have the right LCC projection definition (you
haven't given any of the expected LCC projection parameters - so I
don't know what defaults you are getting), then you could just use a
more modest starting extent to get a "good chunk" of the world.  Something
like EXTENT -5000000 -5000000 5000000 500000.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org



More information about the mapserver-users mailing list