[GRASSLIST:9777] Re: Converst lat/long to x,y - A Bigger Question?

Phillip J. Allen paallen at attglobal.net
Tue Jan 10 09:21:36 EST 2006


That's one option and it will work for this case.  But the bigger 
question is there any easy way to cycle through each of the features and 
then through their subsequent nodes and retrieve xyz? 

Phillip J. Allen


Glynn Clements wrote:

>Michael Ash wrote:
>
>  
>
>>I am reposting an email to which I did not receive a response.  Here
>>is a very brief summary of the problem, and a longer description is
>>below:
>>
>>I would like to transform a set of lat/long maps to a new location on
>>an x,y basis using the following formula,
>>X = Radius*cos(Lat)*Long
>>Y = Lat * Radius
>>where Lat and Long are latitude and longitude (measured in radians)
>>and Radius is an earth's radius.  I know that there are problems
>>(datum, spheroid, non-preservation of area, etc.) with this model
>>(which measures x as arc length along a line of latitude from the
>>prime meridian and y as arc length along a line of longitude from the
>>equator), BUT this is what I want to do.
>>
>>Is there an easy way to have GRASS go through every lat/long point in
>>a vector map and create a matching point in an x,y map USING A
>>SPECIFIED FORMULA?  I do not want to use v.transform (why stretch,
>>when I have a formula).
>>    
>>
>
>You could try v.out.ascii, awk, v.in.ascii, e.g.
>
>v.out.ascii $srcmap format=standard output=srcfile
>awk -v radius=$radius '{ if ($0 ~ /^ [0-9]+\.[0-9]+ [0-9]+\.[0-9]+$/) print " "radius*cos($2)*$1" "radius*$2 ; else print}' < srcfile > dstfile
>v.in.ascii $dstmap format=standard input=dstfile
>
>  
>




More information about the grass-user mailing list