[GRASS-user] ogr2ogr help

Hi,
beginner user. First off, am disappointed with help files for syntax for ogr2ogr.
I have a shp file( with .shx, and .dbf) and want to convert it to a different projection. When I run ogr2ogr from command line, it doesn't do anything, I tried to set the debug level for more verbose and there is not enough information to get debug to work. I assume debug is like verbose. I tried --debug [on], --debug 1. Just get back usage description.

Here is the command I'm using:
ogr2ogr -f "ESRI Shapefile" -t_srs EPSG:32610 myfile.shp mynewfile.shp

it just returns the usage description help file. No errors, no way of knowing what is wrong. I looked online at gdal.org and it is almost worthless for help.
p.s. I also have "Desktop GIS" by Gary Sherman and not all the book examples work(pg 188).thanks,
Tom

2009/1/25 <mtnbiketrail@zzz.com>:

Hi,
beginner user. First off, am disappointed with help files for syntax for
ogr2ogr.
I have a shp file( with .shx, and .dbf) and want to convert it to a
different projection. When I run ogr2ogr from command line, it doesn't do
anything, I tried to set the debug level for more verbose and there is not
enough information to get debug to work. I assume debug is like verbose. I
tried --debug [on], --debug 1. Just get back usage description.

Here is the command I'm using:
ogr2ogr -f "ESRI Shapefile" -t_srs EPSG:32610 myfile.shp mynewfile.shp

it just returns the usage description help file. No errors, no way of
knowing what is wrong. I looked online at gdal.org and it is almost
worthless for help.
p.s. I also have "Desktop GIS" by Gary Sherman and not all the book examples
work(pg 188).thanks,
Tom

Hi Tom. I think that you have an error syntax, at least. You must
write first the name of the destination shape file, and later the name
of the source shape file.

Try this:

ogr2ogr -f "ESRI Shapefile" -t_srs EPSG:32610 mynewfile.shp myfile.shp

Also, make sure that your source shape file, has a coordinate system
defined. You can verify this using ogrinfo:

ogrinfo -so myfile.shp myfile

If not, use the option "-s_srs" to assign one, like following:

ogr2ogr -f "ESRI Shapefile" -s_srs EPSG:4326 -t_srs EPSG:32610
mynewfile.shp myfile.shp

Change EPSG:4326 to the correct epsg code.

I hope that be useful.

Saludos
José María

Hi Tom.

On Sun, 2009-01-25 at 16:33 -0800, mtnbiketrail@zzz.com wrote:

Hi, beginner user. First off, am disappointed with help files for syntax for
ogr2ogr.

[ For the records: this comment should be normally directed to the
"gdal" [1] mailing list ]

I have a shp file( with .shx, and .dbf) and want to convert it to a
different projection.

Is there the ".prj" file which contains the relevant "projection"
parameters?

Maybe you also need to "add" a projection to your vector map if the
".prj" file is missing (?). You can do that with the "-a_srs" parameter.

[...]

Here is the command I'm using:
ogr2ogr -f "ESRI Shapefile" -t_srs EPSG:32610 myfile.shp mynewfile.shp

Take a look in the syntax (output of ogr2ogr): first you have to provide
a name for the *destination* and then the *source* filename. I think
your command should look like:
ogr2ogr -t_srs EPSG:32610 mynewfile.shp myfile.shp

[...]

p.s. I also have "Desktop GIS" by Gary Sherman and not all the book
examples work(pg 188).thanks,

This is a remark which should probably be directed to the author(?).

Tom

Kind regards, Nikos
---
[1] gdal-dev@lists.osgeo.org

Thanks.
I see I missed that output file goes first.

I would have thought a 3d shape file has coordinate system embedded in it. Otherwise the only info I have is that it is NAD83 UTM Zone 10. Indeed, ogrinfo says Layer SRS WKT: (unknown)

I looked on the spatialreference.org website and I have 3 choices. 3717(which I think it is not, as this shp file was made in 2006, 3740, and 26910. How do I guess?

José María Michia wrote:

2009/1/25 <mtnbiketrail@zzz.com>:
  

Hi,
beginner user. First off, am disappointed with help files for syntax for
ogr2ogr.
I have a shp file( with .shx, and .dbf) and want to convert it to a
different projection. When I run ogr2ogr from command line, it doesn't do
anything, I tried to set the debug level for more verbose and there is not
enough information to get debug to work. I assume debug is like verbose. I
tried --debug [on], --debug 1. Just get back usage description.

Here is the command I'm using:
ogr2ogr -f "ESRI Shapefile" -t_srs EPSG:32610 myfile.shp mynewfile.shp

it just returns the usage description help file. No errors, no way of
knowing what is wrong. I looked online at gdal.org and it is almost
worthless for help.
p.s. I also have "Desktop GIS" by Gary Sherman and not all the book examples
work(pg 188).thanks,
Tom
    
Hi Tom. I think that you have an error syntax, at least. You must
write first the name of the destination shape file, and later the name
of the source shape file.

Try this:

ogr2ogr -f "ESRI Shapefile" -t_srs EPSG:32610 mynewfile.shp myfile.shp

Also, make sure that your source shape file, has a coordinate system
defined. You can verify this using ogrinfo:

ogrinfo -so myfile.shp myfile

If not, use the option "-s_srs" to assign one, like following:

ogr2ogr -f "ESRI Shapefile" -s_srs EPSG:4326 -t_srs EPSG:32610
mynewfile.shp myfile.shp

Change EPSG:4326 to the correct epsg code.

I hope that be useful.

Saludos
José María
------------------------------------------------------------------------

No virus found in this incoming message.
Checked by AVG - http://www.avg.com Version: 8.0.176 / Virus Database: 270.10.13/1914 - Release Date: 1/24/2009 8:40 PM

Hi list,
I would like to read out all holes and the boundering area (shell) separately from a MultiPolygon , but I can't se how this is done.
I have created a test polygon with two holes.

SimpleFeature feature = (SimpleFeature) iterator.next();
Geometry g = (Geometry)feature.getDefaultGeometry();

int noGeo = g.getNumGeometries(); // 1 geometry
for(int i = 0; i < noGeo; i++)
{
  Geometry n = g.getGeometryN(i);
  int noP = n.getNumPoints(); // 58 points 44 for the shell, 4 and 4 for the holes
  Coordinate co = g.getCoordinates(); // a cordinate list of 58 point
}

Do I have to iterate through the coordinate array and look for equal coordinates to read out the bounding polygon and the holes,
or is there a more simple (faster) way?

Kind regards,
Paul