[GRASS-user] Import, project

Hamish hamish_b at yahoo.com
Thu Jun 17 22:48:27 EDT 2010


stn wrote:
> First there is the problem that I do not know the coordinates and 
> projection etc of the two files mentioned. Of course I can go to someone
> with esri-software and ask him to check that for me.

as long as you have the gdal tools installed, you can use gdalinfo and
ogrinfo to interrogate the data files for all sorts of information,
including the projection info (if any), spatial extent, max, min,
colors, data type, etc etc. ...

> But in my (apparently very naive) view I this is completely not the
> point. If I have to use esri anyway then why bother taking data into
> grass ??

(gdal and grass typically give you all the tools you'd ever need)


> What I would think is this: If I can find out the projection/coordinates
> etc of the shapefile by any manual means then this info MUST BE included
> in the shapefile itself. Along with the actual geodata.

as others have mentioned, look for an associated .prj file with that
info in it. If importing from the GRASS startup screen there is an option
to create a new location based on geodata. Point it at your shapefile
and chances are it'll find the map projection info it needs and set up
the new Location for you automatically.

> More so the import-program within grass cannot import even a single byte
> without thorough knowledge of the imported format, but i seems that it
> can only read objects but not their coordinate-system.

(it can; if no georeferencing info is available it will import into a
simple XY coordinate system and you can set GCPs or whatever from there)

> So: If all the info is already in the shapefile there then why 
> 1) do I have to manually find it by some way outside grass and 

(you don't)

> 2) why doesn't the import-program simply read that info from the file,
> read the coordinates and projection from the current location and the
> call the appropriate projection-program to reproject the imported file
> to fit the current location.

If does everything but the reprojection for you. And that is mostly done
for your own protection (& I can say that with a straight face). GRASS
generally refuses to make dangerous assumptions on your behalf.

If you want to do the reprojection before GRASS it just takes a moment
with gdalwarp for rasters and ogr2ogr for vector maps. And within GRASS
it's a simple call to r.proj or v.proj + the map name. If it were in
practice a real PITA to do this I can guarantee that someone would have
written a work-around for it many years ago. That they haven't suggests
to me that it isn't as bad as it might seem at first.


> All the infos (proj/coord/bounds/etc) of import and target are there
> (says the naive man :-) ,

if you are lucky! typically at least the datum transform options will
be missing and you'll have to select that from a list presented to you.

> I don't really mind doing that for one map. But somehow I expect lots
> more maps from different sources being added later and each one causing
> lots of work.

for me anyway, I commonly get data in 1-4 map projections, so I just have
5 Locations set up for those and each new dataset gets its own mapset
within them.

> What is it I don't understand here?

I think you just hadn't been introduced to the 'create new Location
using geodata' button.


> > from the command line GDAL's ogr2ogr and gdalwarp can reproject
> > shapefiles and GeoTiffs etc directly.
>
> Tried that (on ubuntu) :
>
> user at nb ~ $ gdalwarp file1.shp file1.out
> ERROR 4: `file1.shp' not recognised as a supported file format.

gdal is for raster images, ogr is for vector data. So use ogr2ogr
for that. If you don't know about EPSG codes now's a good time to
learn, they'll make your life much easier.


regards,
Hamish



      


More information about the grass-user mailing list