[GRASS-user] batch import/sql shapefiles

Hi,

This simple script doesn't seem to work on my cygwin bash

for i in *.shp; do
  ogr2ogr -f "ESRI Shapefile" -where "ELEVATION>10" $i_elev $i;
done

I'm trying to extract elevation contour lines from a couple of shapefiles
I know it worked before on my linux.

cheers,
maning

--
|---------|----------------------------------------------------------|
| __.-._ |"Ohhh. Great warrior. Wars not make one great." -Yoda |
| '-._"7' |"Freedom is still the most radical idea of all" -N.Branden|
| /'.-c |Linux registered user #402901, http://counter.li.org/ |
| | /T |http://esambale.wikispaces.com|
| _)_/LI
|---------|----------------------------------------------------------|

On Tue, 2008-05-13 at 15:52 +0800, maning sambale wrote:

Hi,

This simple script doesn't seem to work on my cygwin bash

for i in *.shp; do
  ogr2ogr -f "ESRI Shapefile" -where "ELEVATION>10" $i_elev $i;
done

I'm trying to extract elevation contour lines from a couple of shapefiles
I know it worked before on my linux.

cheers,
maning

Maybe a problem with the "quotes" in the expression(s)?

I don't think so, this one worked:

ogr2ogr -f "ESRI Shapefile" -where "ELEVATION>10" new13744-4.shp 3744-4.shp

On Tue, May 13, 2008 at 3:54 PM, Nikos Alexandris
<nikos.alexandris@felis.uni-freiburg.de> wrote:

On Tue, 2008-05-13 at 15:52 +0800, maning sambale wrote:
> Hi,
>
> This simple script doesn't seem to work on my cygwin bash
>
> for i in *.shp; do
> ogr2ogr -f "ESRI Shapefile" -where "ELEVATION>10" $i_elev $i;
> done
>
> I'm trying to extract elevation contour lines from a couple of shapefiles
> I know it worked before on my linux.
>
> cheers,
> maning

Maybe a problem with the "quotes" in the expression(s)?

--
|---------|----------------------------------------------------------|
| __.-._ |"Ohhh. Great warrior. Wars not make one great." -Yoda |
| '-._"7' |"Freedom is still the most radical idea of all" -N.Branden|
| /'.-c |Linux registered user #402901, http://counter.li.org/ |
| | /T |http://esambale.wikispaces.com|
| _)_/LI
|---------|----------------------------------------------------------|

maning sambale wrote:

This simple script doesn't seem to work on my cygwin
bash

for i in *.shp; do
  ogr2ogr -f "ESRI Shapefile" -where "ELEVATION>10" $i_elev $i;
done

I'm trying to extract elevation contour lines from a
couple of shapefiles

$i_elev --> ${i}_elev

Hamish

On 13/05/08 09:57, maning sambale wrote:

I don't think so, this one worked:

ogr2ogr -f "ESRI Shapefile" -where "ELEVATION>10" new13744-4.shp 3744-4.shp

On Tue, May 13, 2008 at 3:54 PM, Nikos Alexandris
<nikos.alexandris@felis.uni-freiburg.de> wrote:

On Tue, 2008-05-13 at 15:52 +0800, maning sambale wrote:
> Hi,
>
> This simple script doesn't seem to work on my cygwin bash
>
> for i in *.shp; do
> ogr2ogr -f "ESRI Shapefile" -where "ELEVATION>10" $i_elev $i;

Try with $i\_elev instead of $i_elev.

Moritz

Both didn't worked.

$i_elev --> ${i}_elev

$i\_elev instead of $i_elev.

--
|---------|----------------------------------------------------------|
| __.-._ |"Ohhh. Great warrior. Wars not make one great." -Yoda |
| '-._"7' |"Freedom is still the most radical idea of all" -N.Branden|
| /'.-c |Linux registered user #402901, http://counter.li.org/ |
| | /T |http://esambale.wikispaces.com|
| _)_/LI
|---------|----------------------------------------------------------|

On 13.05.2008 10:52, maning sambale wrote:

Hi,

This simple script doesn't seem to work on my cygwin bash

for i in *.shp; do
  ogr2ogr -f "ESRI Shapefile" -where "ELEVATION>10" $i_elev $i;
done

You have two errors:

1) (as Hamish pointed out) $i_elev is a legal variable name so you want {$i}_elev
2) {i}_elev will become shapefile.shp_elev, which ogr2ogr might have a problem with..

so instead try: $i_elev ==> elev_$i

--Wolf

--

<:3 )---- Wolf Bergenheim ----( 8:>

Wolf,

Aha! It works now!

Salamat!

maning

On Tue, May 13, 2008 at 5:59 PM, Wolf Bergenheim
<wolf+grass@bergenheim.net> wrote:

On 13.05.2008 10:52, maning sambale wrote:

> Hi,
>
> This simple script doesn't seem to work on my cygwin bash
>
> for i in *.shp; do
> ogr2ogr -f "ESRI Shapefile" -where "ELEVATION>10" $i_elev $i;
> done
>
>

You have two errors:

1) (as Hamish pointed out) $i_elev is a legal variable name so you want
{$i}_elev
2) {i}_elev will become shapefile.shp_elev, which ogr2ogr might have a
problem with..

so instead try: $i_elev ==> elev_$i

--Wolf

--

<:3 )---- Wolf Bergenheim ----( 8:>

--
|---------|----------------------------------------------------------|
| __.-._ |"Ohhh. Great warrior. Wars not make one great." -Yoda |
| '-._"7' |"Freedom is still the most radical idea of all" -N.Branden|
| /'.-c |Linux registered user #402901, http://counter.li.org/ |
| | /T |http://esambale.wikispaces.com|
| _)_/LI
|---------|----------------------------------------------------------|

Hi all

I've been working with the linux version of GRASS since two years with no
problems but now i'm trying to make my GRASS based application in Windows
using the cygwin port. I've noticed that some GRASS commands doesn't work
properly but they don't even show any error nor any output.

I'm very confused because cygcheck don't show me nothing bad about this
commands. And the return code that bash gets is 128.

I have reinstalled cygwin + GRASS today (with the latest stable version)
from Internet on my XP machine and still doesn't work. T_T

Any help would be appreciated.

Here is some example of commands not working at all...

Welcome to GRASS 6.2.3 (2007)
GRASS homepage: http://grass.itc.it/
This version running thru: GNU Bash (Cygwin)
(/usr/bin/bash.exe)
Help is available with the command: g.manual -i
See the licence terms with: g.version -c
Start the graphical user interface with: gis.m &
When ready to quit enter: exit
GRASS 6.2.3 (TEST):~ > g.remove
GRASS 6.2.3 (TEST):~ > g.region -p
GRASS 6.2.3 (TEST):~ > echo $?
128
GRASS 6.2.3 (TEST):~ >

Thanks in advance.
Manuel Francisco Maestre Páez

Manuel Francisco Maestre Páez wrote:

I've been working with the linux version of GRASS since two years with no
problems but now i'm trying to make my GRASS based application in Windows
using the cygwin port. I've noticed that some GRASS commands doesn't work
properly but they don't even show any error nor any output.

This is normally due to a problem with DLLs.

Cygwin intentionally suppresses the dialog which normally pops up if a
DLL cannot be found or is incorrect in some way.

I'm very confused because cygcheck don't show me nothing bad about this
commands. And the return code that bash gets is 128.

Cygcheck normally identifies these problems, but it isn't foolproof.
ISTR that it doesn't catch the case where a DLL is found but is
incompatible (e.g. doesn't define all needed symbols).

I have reinstalled cygwin + GRASS today (with the latest stable version)
from Internet on my XP machine and still doesn't work. T_T

Any help would be appreciated.

Here is some example of commands not working at all...

g.remove and g.region both depend upon GDAL (the vector libraries
depend upon GDAL, so anything which depends upon the vector libraries
also depends upon GDAL). Although there are other libraries involved,
GDAL is usually the prime suspect because it usually depends upon many
other libraries.

Do the GDAL tools (gdalinfo, ogrinfo, etc) work?

--
Glynn Clements <glynn@gclements.plus.com>

@Hamish: The path wasn't the problem. ^_^'

@Glynn Clements: It seems that GDAL isn't working either. gdalinfo and
ogrinfo behaves the same way as g.remove and g.region (and many others).

Which libraries do i need to install?

Thanks all for the answers. Keep up the good work!

Manuel Francisco Maestre Páez

-----Glynn Clements <glynn@gclements.plus.com> escribió: -----

Para: "Manuel Francisco Maestre Páez" <mfmap@tragsatec.es>
De: Glynn Clements <glynn@gclements.plus.com>
Fecha: 14/05/2008 00:13
cc: grass-user <grass-user@lists.osgeo.org>
Asunto: Re: [GRASS-user] Weird Cygwin -Grass 6.3.3 issues

Manuel Francisco Maestre Páez wrote:

I've been working with the linux version of GRASS since two years with no
problems but now i'm trying to make my GRASS based application in Windows
using the cygwin port. I've noticed that some GRASS commands doesn't work
properly but they don't even show any error nor any output.

This is normally due to a problem with DLLs.

Cygwin intentionally suppresses the dialog which normally pops up if a
DLL cannot be found or is incorrect in some way.

I'm very confused because cygcheck don't show me nothing bad about this
commands. And the return code that bash gets is 128.

Cygcheck normally identifies these problems, but it isn't foolproof.
ISTR that it doesn't catch the case where a DLL is found but is
incompatible (e.g. doesn't define all needed symbols).

I have reinstalled cygwin + GRASS today (with the latest stable version)
from Internet on my XP machine and still doesn't work. T_T

Any help would be appreciated.

Here is some example of commands not working at all...

g.remove and g.region both depend upon GDAL (the vector libraries
depend upon GDAL, so anything which depends upon the vector libraries
also depends upon GDAL). Although there are other libraries involved,
GDAL is usually the prime suspect because it usually depends upon many
other libraries.

Do the GDAL tools (gdalinfo, ogrinfo, etc) work?

--
Glynn Clements <glynn@gclements.plus.com>

Manuel Francisco Maestre Páez wrote:

@Glynn Clements: It seems that GDAL isn't working either. gdalinfo and
ogrinfo behaves the same way as g.remove and g.region (and many others).

Which libraries do i need to install?

The ones which your version of GDAL requires. If you're using the
gdal-1.3.1-1 package from the GRASS site, setup.ini says that it
requires:

  requires: cygwin jasper libpng12 libpq4 libtiff5

The Cygwin installer should take care of this automatically.

But I can't guarantee that is correct; in particular, I think that it
requires jpeg62. Try running cygcheck on cyggdal-1.dll.

--
Glynn Clements <glynn@gclements.plus.com>

Thanks for the answer, but i tried checking cyggdal-1.dll and it seems it's
all ok.

I have installed all the libraries you said (and some more just in case) i
tried different versions for some of them, but... still no luck.

What can it be? I'm getting frustrated `_´

$ cygcheck /usr/local/bin/cyggdal-1.dll
C:\cygwin\usr/local/bin/cyggdal-1.dll
  C:\cygwin\bin\cygwin1.dll
    C:\WINDOWS\System32\ADVAPI32.DLL
      C:\WINDOWS\System32\ntdll.dll
      C:\WINDOWS\System32\KERNEL32.dll
      C:\WINDOWS\System32\RPCRT4.dll
  C:\WINDOWS\System32\cygjasper-1-701-1.dll
    C:\cygwin\bin\cygjpeg-62.dll
  C:\cygwin\bin\cygpng12.dll
    C:\cygwin\bin\cygz.dll
  C:\cygwin\bin\cygpq.dll
    C:\cygwin\bin\cygcrypt-0.dll
    C:\WINDOWS\System32\cygcrypto-0.9.8.dll
    C:\cygwin\bin\cygintl-3.dll
      C:\cygwin\bin\cygiconv-2.dll
    C:\cygwin\bin\cygssl-0.9.8.dll
  C:\cygwin\bin\cygtiff-5.dll

Manuel Francisco Maestre Páez

-----Glynn Clements <glynn@gclements.plus.com> escribió: -----

Para: "Manuel Francisco Maestre Páez" <mfmap@tragsatec.es>
De: Glynn Clements <glynn@gclements.plus.com>
Fecha: 14/05/2008 20:02
cc: grass-user <grass-user@lists.osgeo.org>
Asunto: Re: Re: [GRASS-user] Weird Cygwin -Grass 6.2.3 issues

Manuel Francisco Maestre Páez wrote:

@Glynn Clements: It seems that GDAL isn't working either. gdalinfo and
ogrinfo behaves the same way as g.remove and g.region (and many others).

Which libraries do i need to install?

The ones which your version of GDAL requires. If you're using the
gdal-1.3.1-1 package from the GRASS site, setup.ini says that it
requires:

    requires: cygwin jasper libpng12 libpq4 libtiff5

The Cygwin installer should take care of this automatically.

But I can't guarantee that is correct; in particular, I think that it
requires jpeg62. Try running cygcheck on cyggdal-1.dll.

--
Glynn Clements <glynn@gclements.plus.com>

Manuel Francisco Maestre Páez wrote:

Thanks for the answer, but i tried checking cyggdal-1.dll and it seems it's
all ok.

I have installed all the libraries you said (and some more just in case) i
tried different versions for some of them, but... still no luck.

What can it be? I'm getting frustrated `_´

$ cygcheck /usr/local/bin/cyggdal-1.dll
C:\cygwin\usr/local/bin/cyggdal-1.dll
  C:\cygwin\bin\cygwin1.dll
    C:\WINDOWS\System32\ADVAPI32.DLL
      C:\WINDOWS\System32\ntdll.dll
      C:\WINDOWS\System32\KERNEL32.dll
      C:\WINDOWS\System32\RPCRT4.dll
  C:\WINDOWS\System32\cygjasper-1-701-1.dll
    C:\cygwin\bin\cygjpeg-62.dll
  C:\cygwin\bin\cygpng12.dll
    C:\cygwin\bin\cygz.dll
  C:\cygwin\bin\cygpq.dll
    C:\cygwin\bin\cygcrypt-0.dll
    C:\WINDOWS\System32\cygcrypto-0.9.8.dll
    C:\cygwin\bin\cygintl-3.dll
      C:\cygwin\bin\cygiconv-2.dll
    C:\cygwin\bin\cygssl-0.9.8.dll
  C:\cygwin\bin\cygtiff-5.dll

The fact that cygjasper-1-701-1.dll and cygcrypto-0.9.8.dll are in
C:\WINDOWS\System32 isn't encouraging. Cygwin-specific DLLs shouldn't
exist anywhere outside of C:\cygwin.

Also, you could try running cygcheck on the executables themselves,
e.g. gdalinfo etc.

--
Glynn Clements <glynn@gclements.plus.com>

Thanks again.

I've tried moving that two libraries to c:/cygwin/bin and "cygchecking" all
executables in /usr/local/bin . All of them seems ok but i got the same
results (i mean, nothing). The exit code is still the same too (128).

I keep on trying... Never give up!

Manuel Francisco Maestre Páez

P.D.
This the result of cygcheck now:
...
$ cygcheck /usr/local/bin/cyggdal-1.dll
C:\cygwin\usr/local/bin/cyggdal-1.dll
  C:\cygwin\bin\cygwin1.dll
    C:\WINDOWS\System32\ADVAPI32.DLL
      C:\WINDOWS\System32\ntdll.dll
      C:\WINDOWS\System32\KERNEL32.dll
      C:\WINDOWS\System32\RPCRT4.dll
  C:\cygwin\bin\cygjasper-1-701-1.dll
    C:\cygwin\bin\cygjpeg-62.dll
  C:\cygwin\bin\cygpng12.dll
    C:\cygwin\bin\cygz.dll
  C:\cygwin\bin\cygpq.dll
    C:\cygwin\bin\cygcrypt-0.dll
    C:\cygwin\bin\cygcrypto-0.9.8.dll
    C:\cygwin\bin\cygintl-3.dll
      C:\cygwin\bin\cygiconv-2.dll
    C:\cygwin\bin\cygssl-0.9.8.dll
  C:\cygwin\bin\cygtiff-5.dll
...

All gdal executables are giving the same cygcheck output.

-----Glynn Clements <glynn@gclements.plus.com> escribió: -----

Para: "Manuel Francisco Maestre Páez" <mfmap@tragsatec.es>
De: Glynn Clements <glynn@gclements.plus.com>
Fecha: 19/05/2008 14:22
cc: grass-user <grass-user@lists.osgeo.org>
Asunto: Re: [GRASS-user] Weird Cygwin -Grass 6.2.3 issues

Manuel Francisco Maestre Páez wrote:

Thanks for the answer, but i tried checking cyggdal-1.dll and it seems

it's

all ok.

I have installed all the libraries you said (and some more just in case)

i

tried different versions for some of them, but... still no luck.

What can it be? I'm getting frustrated `_´

$ cygcheck /usr/local/bin/cyggdal-1.dll
C:\cygwin\usr/local/bin/cyggdal-1.dll
  C:\cygwin\bin\cygwin1.dll
    C:\WINDOWS\System32\ADVAPI32.DLL
      C:\WINDOWS\System32\ntdll.dll
      C:\WINDOWS\System32\KERNEL32.dll
      C:\WINDOWS\System32\RPCRT4.dll
  C:\WINDOWS\System32\cygjasper-1-701-1.dll
    C:\cygwin\bin\cygjpeg-62.dll
  C:\cygwin\bin\cygpng12.dll
    C:\cygwin\bin\cygz.dll
  C:\cygwin\bin\cygpq.dll
    C:\cygwin\bin\cygcrypt-0.dll
    C:\WINDOWS\System32\cygcrypto-0.9.8.dll
    C:\cygwin\bin\cygintl-3.dll
      C:\cygwin\bin\cygiconv-2.dll
    C:\cygwin\bin\cygssl-0.9.8.dll
  C:\cygwin\bin\cygtiff-5.dll

The fact that cygjasper-1-701-1.dll and cygcrypto-0.9.8.dll are in
C:\WINDOWS\System32 isn't encouraging. Cygwin-specific DLLs shouldn't
exist anywhere outside of C:\cygwin.

Also, you could try running cygcheck on the executables themselves,
e.g. gdalinfo etc.

--
Glynn Clements <glynn@gclements.plus.com>

Thanks but didn't work copying the libs to the lib dir... I think the
location of the dll's it s not a problem as long as they are in the system
path...

I keep trying!

Manuel Francisco Maestre Páez

-----Milan Salek <salek@chmi.cz> escribió: -----

Para: Manuel Francisco Maestre Páez <mfmap@tragsatec.es>
De: Milan Salek <salek@chmi.cz>
Fecha: 19/05/2008 17:13
Asunto: Re: [GRASS-user] Weird Cygwin -Grass 6.2.3 issues

Have you tried to put them into the c:/cygwin/lib? The *.dll files should
be
IMHO in some "lib" directory.

Milan

Manuel Francisco Maestre Páez napsal(a):

Thanks again.

I've tried moving that two libraries to c:/cygwin/bin and "cygchecking"

all

executables in /usr/local/bin . All of them seems ok but i got the same
results (i mean, nothing). The exit code is still the same too (128).

I keep on trying... Never give up!

Manuel Francisco Maestre Páez

P.D.
This the result of cygcheck now:
...
$ cygcheck /usr/local/bin/cyggdal-1.dll
C:\cygwin\usr/local/bin/cyggdal-1.dll
  C:\cygwin\bin\cygwin1.dll
    C:\WINDOWS\System32\ADVAPI32.DLL
      C:\WINDOWS\System32\ntdll.dll
      C:\WINDOWS\System32\KERNEL32.dll
      C:\WINDOWS\System32\RPCRT4.dll
  C:\cygwin\bin\cygjasper-1-701-1.dll
    C:\cygwin\bin\cygjpeg-62.dll
  C:\cygwin\bin\cygpng12.dll
    C:\cygwin\bin\cygz.dll
  C:\cygwin\bin\cygpq.dll
    C:\cygwin\bin\cygcrypt-0.dll
    C:\cygwin\bin\cygcrypto-0.9.8.dll
    C:\cygwin\bin\cygintl-3.dll
      C:\cygwin\bin\cygiconv-2.dll
    C:\cygwin\bin\cygssl-0.9.8.dll
  C:\cygwin\bin\cygtiff-5.dll
...

All gdal executables are giving the same cygcheck output.

-----Glynn Clements <glynn@gclements.plus.com> escribió: -----

Para: "Manuel Francisco Maestre Páez" <mfmap@tragsatec.es>
De: Glynn Clements <glynn@gclements.plus.com>
Fecha: 19/05/2008 14:22
cc: grass-user <grass-user@lists.osgeo.org>
Asunto: Re: [GRASS-user] Weird Cygwin -Grass 6.2.3 issues

Manuel Francisco Maestre Páez wrote:

Thanks for the answer, but i tried checking cyggdal-1.dll and it seems

it's

all ok.

I have installed all the libraries you said (and some more just in case)

i

tried different versions for some of them, but... still no luck.

What can it be? I'm getting frustrated `_´

$ cygcheck /usr/local/bin/cyggdal-1.dll
C:\cygwin\usr/local/bin/cyggdal-1.dll
  C:\cygwin\bin\cygwin1.dll
    C:\WINDOWS\System32\ADVAPI32.DLL
      C:\WINDOWS\System32\ntdll.dll
      C:\WINDOWS\System32\KERNEL32.dll
      C:\WINDOWS\System32\RPCRT4.dll
  C:\WINDOWS\System32\cygjasper-1-701-1.dll
    C:\cygwin\bin\cygjpeg-62.dll
  C:\cygwin\bin\cygpng12.dll
    C:\cygwin\bin\cygz.dll
  C:\cygwin\bin\cygpq.dll
    C:\cygwin\bin\cygcrypt-0.dll
    C:\WINDOWS\System32\cygcrypto-0.9.8.dll
    C:\cygwin\bin\cygintl-3.dll
      C:\cygwin\bin\cygiconv-2.dll
    C:\cygwin\bin\cygssl-0.9.8.dll
  C:\cygwin\bin\cygtiff-5.dll

The fact that cygjasper-1-701-1.dll and cygcrypto-0.9.8.dll are in
C:\WINDOWS\System32 isn't encouraging. Cygwin-specific DLLs shouldn't
exist anywhere outside of C:\cygwin.

Also, you could try running cygcheck on the executables themselves,
e.g. gdalinfo etc.

--
Glynn Clements <glynn@gclements.plus.com>

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

--
   ___________
   \ o o / Milan Salek
    \ ^ / Regionalni predpovedni pracoviste
     \ ~ / Regional Forecasting Office Brno
     ( ( ) ) Czech Hydrometeorological Institute
   ( ( . ) ) Kroftova 43, 616 67 Brno, Czech Republic
( ( . ) )
(____________) ) tel.: +420-541 421 072
     //// fax : +420-541 421 018
    //// E-mail: salek@chmi.cz
                  cell phone: +420-724 185 618
http://www.chmi.cz

Ceska meteor. spolecnost / Czech Meteorological Society:
http://www.chmi.cz/poboc/BR/metspol/metspol.html
------------------------------------------------------------
"Prediction is very difficult, especially about the future."
-- Niels Bohr
------------------------------------------------------------