Raffaello Brondi wrote: > >> i'm using GRASS 6.2 for developing a Web Processing Service. > > > > Have you seen Jachym's PyWPS? > > http://pywps.wald.intevation.org > > > yes i saw it..but unfortunately i have to develop the service using > Java.
Have you seen jGRASS? http://www.jgrass.org/ Raffaello: > >> One of the operations offered by the service takes two raster maps > >> as inputs. > >> The raster map resulting from this operation would have different > >> spatial extents based on the input maps: the result would have the > >> extent equal to the extent of one of the two input maps, or equal to > >> the union of the extents of the two input maps or equal to the > >> intersection of the extents of the two raster maps. > >> In order to develop the service i need to manage these four cases by > >> changing the GRASS region. > >> Supposing that the input rasters are "raster1" and "raster2", the > >> possible configurations are: > >> > >> 1. region = raster1 --> g.region rast=raster1 > >> 2. region = raster2 --> g.region rast=raster2 > >> 3. region = the union of raster1 and raster2 --> g.region > >> rast=raster1,raster2 > >> 4. region = the intersection of raster1 and raster2 --> ? > >> > >> > >> As far as i see, using the g.region command, there is no way to > >> specify the last point except to manually set the nord,sud,ovest and > >> east values, but unfortunately i can not use this way. > >> Is there any other command in GRASS that i can use instead of > >> g.region to set the current region as the intersection of two > >> rasters? > > Hamish: > > This is not very efficient, and more like 'g.region zoom=', but you > > could do: > > > > g.region rast=map1,map2 > > r.mapcalc 'intersect= if(!isnull(map1) && !isnull(map2), 1, null())' > > g.region zoom=intersect > > g.remove intersect Raffaello: > This is the solution i need :). Wolf: > g.region rast=raster1 > g.region -p (parse the output, into rast1north, rast1east, rast1west, > rast1south, etc) > g.region rast=raster2 > g.region -p (parse the output, into rast2north, rast2east, rast2west, > rast2south, etc) > g.region north=(min of rast1north, rast2northe) etc for other > parameters. Raffaello: > Your solution is a good one but the problem is the overhead it > introduces. Since i can't (or maybe i'm not able to :( ) interact > directly with GRASS using Java, i would need to make 4 files > reading/writing. Running g.region twice is going to have way less overhead than running r.mapcalc, especially if the maps are of a reasonable size. GRASS now has SWIG bindings to help closely link GRASS's libgis etc. into higher level languages than C/C++. Right now we have some parts in place for perl & python, but a motivated contributor could add java to that list. look in the swig/ directory in the 6.3 source code. http://www.swig.org/Doc1.3/Java.html Hamish _______________________________________________ grassuser mailing list [email protected] http://grass.itc.it/mailman/listinfo/grassuser

