[GRASS-user] One more m.proj question
Roger Loweth
roger.loweth at gmail.com
Wed Jun 15 09:04:30 EDT 2011
Me again,
Here is a snippet of my Python script which deals with importing
seismic navigation files into Grass:
#transform to our current location
lonlatString = str(lon_value) + ' ' + str(lat_value)
tmpCoords = open(tmpFile, 'w')
tmpCoords.write(lonlatString)
tmpCoords.close()
if lat_value < 90: #it must be lat/lon
outlonlatString = grass.read_command('m.proj',
input=tmpFile, proj_in=in_datum_def, proj_out=out_datum_def,
flags='d')
longitude = eval(outlonlatString.split()[0])
latitude = eval(outlonlatString.split()[1])
outeastnorthString=grass.read_command('m.proj',
input=tmpFile, proj_in=in_datum_def, proj_out=out_proj_def)
easting = eval(outeastnorthString.split()[0])
northing = eval(outeastnorthString.split()[1])
All I'm trying to do here is pass my latitude and longitude values to
m.proj. You can see that I've come up with some really klutzy code to
accomplish this by writing the values to a temporary file and then
reading the file with m.proj.
It works but it is AWFULLY slow!!
Can anyone come up with a better solution please?
Thanks, Roger
Roger Loweth
More information about the grass-user
mailing list