[GRASS-user] Most efficient way to import a lat-lon shapefile into, say, a Lambert Conic Conformal location?

Hamish hamish_nospam at yahoo.com
Mon Jul 23 03:34:02 EDT 2007


Thomas Adams wrote:
> > >> What is the most efficient way to import a lat-lon shapefile
> > >> into, say, a Lambert Conic Conformal location? Up to this point
> > >> if I wanted to do this, I would exit GRASS (6.2.1) from my
> > >> Lambert Conic Conformal location. Then, start-up GRASS in a
> > >> lat-lon location, import the shapefile, then, exit GRASS, and
> > >> re-start GRASS into my LCC location, where I would reproject the
> > >> map from the lat-lon location into my LCC location. OBVIOUSLY,
> > >> this works (and I could write a simple script to automate this),
> > >> but it seems there ought to be a way to do this all within my
> > >> original LCC location. So, is there some way to do this — it's
> > >> not very obvious to me.

Maciek wrote:
> Reproject the shapefile from latlong to LCC outside GRASS using
> ogr2ogr, then import the LCC shapefile into your LCC GRASS location.


> > Carlos wrote:
> > > You can create a new location in the import step, so you don't
> > > have to exit from your lambert location.

> Thomas Adams wrote:
> > Thank you for your help. It sounds like I might as well write a
> > simple script because anytime I would want to do this, I would need
> > to create a new location. Either I would end up with a bunch of
> > lat-lon locations, or I would need to delete the one I just created
> > afterwards. So, I might as well write a simple script to handle this
> > process and do the clean-up.

The ogr2ogr method is simplest, but if you want to stay with an all GRASS
solution:

>From within the LCC location you could run a script which calls some
GRASS batch jobs in a loop:

for MAP in `...` ; do
  export VECTMAP=$MAP
  GRASS_BATCH_JOB=script_import.sh  grass63 /path/to/LL/mapset/
                # [v.in.ogr $VECTMAP]
  v.proj in=$VECTMAP location=LL
  GRASS_BATCH_JOB=script_cleanup.sh  grass63 /path/to/LL/mapset/
                # [g.remove vect=$VECTMAP]
done


?,
Hamish




More information about the grass-user mailing list