[gdal-dev] Oracle OCI connection in Python OGR

2010-02-12 Thread Eric Wolf
I'm using GDAL/OGR 1.6.1 with ActivePython 2.6.4-10 and cx_Oracle-5.0.3-11g.
I am trying to connect to an Oracle 11g instance.

This works:

ogr2ogr -f KML emp.kml OCI:scott/tiger EMP

What am I doing wrong. This fails, ds is None:

from osgeo import ogr

try:
d = ogr.GetDriverByName('OCI')
except:
print Unable to GetDriverByName
quit()

ds = None

try:
ds = ogr.Open('OCI:scott/tiger')
except:
print Unable to open OCI connection
quit()

if ds is None:
print Unable to open Oracle connection, ds
quit()

lyr = ds.GetLayerByName('EMP')
number = lyr.GetFeatureCount()

print Features:  + str(number)




-=--=---===---=--=-=--=---==---=--=-=-
Eric B. WolfNew! 720-334-7734
USGS Geographer
Center of Excellence in GIScience
PhD Student
CU-Boulder - Geography

GPG Public Key: http://www.h4h.net/ebwolf.public.key.txt
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

[gdal-dev] How to supress std io of gdal?

2010-02-12 Thread ariasgore
Hello,
I've been looking into the docs and also into the source without much luck.
When it comes to error handling, functions like GDALOpen just dump everything 
to the console when reading file error or similar things occur.

Is this customizable? GDAL is deeply burried in the logic-code part of our code 
which is not supposed to break the architecture by dumping unwanted information 
to the console or whatever is tied to the output stream.
Is there a way to redirect it to some other buffer? Like an internal stream 
which can then be properly propagated via exceptions or written into a log?

Thanks
Sam
-- 
NEU: Mit GMX DSL über 1000,- ¿ sparen!
http://portal.gmx.net/de/go/dsl02
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


[gdal-dev] Colour interpretation missing in the TMS mini-driver

2010-02-12 Thread Homme Zwaagstra
Hello all,

I've been using the TMS mini driver for the first time (gdal 1.7.0)
and came across a problem that I think is due to the driver not
setting ColorInterp values on the raster bands it returns.

The problem arose using the gdal plugin to mapnik whereby all the
images mapnik renders using the TMS data are grayscale. It transpires
that mapnik treats gdal derived images as grayscale if no colour
interpretation is present (using the first band it comes across). You
could say this is a mapnik problem, but it seems to me that it is
Gdal's responsibility to properly define the data it returns. In this
case the TMS is returning RGB PNG images but the problem would also
apply to RGBA data sources.

My current workaround is to wrap the GDAL TMS description file in a
VRT file that explicitly assigns ColorInterp values, and use that VRT
as the mapnik datasource. It would be nice if the TMS driver did this
automatically.

Hopefully I'm not missing anything here; if there are no objections
I'll add this as a bug.

The TMS description I'm using is along these lines:

GDAL_WMS
  Service name=TMS
ServerUrlhttp://my.local.tms/ServerUrl
Layerbathymetry/Layer
Formatpng/Format
  /Service
  DataWindow
UpperLeftX-180.0/UpperLeftX
UpperLeftY90.0/UpperLeftY
LowerRightX180.0/LowerRightX
LowerRightY-90.0/LowerRightY
TileLevel19/TileLevel
TileCountX2/TileCountX
TileCountY1/TileCountY
  /DataWindow
  ProjectionEPSG:4326/Projection
  BlockSizeX256/BlockSizeX
  BlockSizeY256/BlockSizeY
  BandsCount3/BandsCount
  MaxConnections10/MaxConnections
  Timeout5/Timeout
/GDAL_WMS

In case it helps others with the same issue, the VRT that corrects the
problem in mapnik is:

VRTDataset rasterXSize=268435456 rasterYSize=134217728
  SRSGEOGCS[quot;WGS 84quot;,DATUM[quot;WGS_1984quot;,SPHEROID[quot;WGS 
84quot;,6378137,298.257223563,AUTHORITY[quot;EPSGquot;,quot;7030quot;]],AUTHORITY[quot;EPSGquot;,quot;6326quot;]],PRIMEM[quot;Greenwichquot;,0,AUTHORITY[quot;EPSGquot;,quot;8901quot;]],UNIT[quot;degreequot;,0.01745329251994328,AUTHORITY[quot;EPSGquot;,quot;9122quot;]],AUTHORITY[quot;EPSGquot;,quot;4326quot;]]/SRS
  GeoTransform -1.8000e+02,  1.3411045074462891e-06,  
0.e+00,  9.e+01,  0.e+00, 
-1.3411045074462891e-06/GeoTransform
  Metadata/
  VRTRasterBand dataType=Byte band=1
ColorInterpRed/ColorInterp
Metadata/
SimpleSource
  SourceFilename relativeToVRT=1tms.xml/SourceFilename
  SourceBand1/SourceBand
  SourceProperties RasterXSize=268435456 RasterYSize=134217728 
DataType=Byte BlockXSize=256 BlockYSize=256/
  SrcRect xOff=0 yOff=0 xSize=268435456 ySize=134217728/
  DstRect xOff=0 yOff=0 xSize=268435456 ySize=134217728/
/SimpleSource
  /VRTRasterBand
  VRTRasterBand dataType=Byte band=2
ColorInterpGreen/ColorInterp
Metadata/
SimpleSource
  SourceFilename relativeToVRT=1tms.xml/SourceFilename
  SourceBand2/SourceBand
  SourceProperties RasterXSize=268435456 RasterYSize=134217728 
DataType=Byte BlockXSize=256 BlockYSize=256/
  SrcRect xOff=0 yOff=0 xSize=268435456 ySize=134217728/
  DstRect xOff=0 yOff=0 xSize=268435456 ySize=134217728/
/SimpleSource
  /VRTRasterBand
  VRTRasterBand dataType=Byte band=3
ColorInterpBlue/ColorInterp
Metadata/
SimpleSource
  SourceFilename relativeToVRT=1tms.xml/SourceFilename
  SourceBand3/SourceBand
  SourceProperties RasterXSize=268435456 RasterYSize=134217728 
DataType=Byte BlockXSize=256 BlockYSize=256/
  SrcRect xOff=0 yOff=0 xSize=268435456 ySize=134217728/
  DstRect xOff=0 yOff=0 xSize=268435456 ySize=134217728/
/SimpleSource
  /VRTRasterBand
/VRTDataset

Kind regards,

Homme

-- 
Homme Zwaagstra
GeoData Institute
University of Southampton

___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] Oracle OCI connection in Python OGR

2010-02-12 Thread Alan Boudreault
Eric,

Could you try a OCI connection string like:

OCI:user/passw...@host/SID

Alan

On February 12, 2010 04:18:23 am Eric Wolf wrote:
 I'm using GDAL/OGR 1.6.1 with ActivePython 2.6.4-10 and
  cx_Oracle-5.0.3-11g. I am trying to connect to an Oracle 11g instance.
 
 This works:
 
 ogr2ogr -f KML emp.kml OCI:scott/tiger EMP
 
 What am I doing wrong. This fails, ds is None:
 
 from osgeo import ogr
 
 try:
 d = ogr.GetDriverByName('OCI')
 except:
 print Unable to GetDriverByName
 quit()
 
 ds = None
 
 try:
 ds = ogr.Open('OCI:scott/tiger')
 except:
 print Unable to open OCI connection
 quit()
 
 if ds is None:
 print Unable to open Oracle connection, ds
 quit()
 
 lyr = ds.GetLayerByName('EMP')
 number = lyr.GetFeatureCount()
 
 print Features:  + str(number)
 
 
 
 
 -=--=---===---=--=-=--=---==---=--=-=-
 Eric B. WolfNew! 720-334-7734
 USGS Geographer
 Center of Excellence in GIScience
 PhD Student
 CU-Boulder - Geography
 
 GPG Public Key: http://www.h4h.net/ebwolf.public.key.txt
 

-- 
Alan Boudreault
Mapgears
http://www.mapgears.com
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] How to supress std io of gdal?

2010-02-12 Thread Ivan Lucena
Sam,

  Is there a way to redirect it to some other buffer? Like an internal stream 
 which can then be properly propagated via exceptions or written into a log?

It is probably not as sophisticated as you want or need but have you tried that:

gdalinfo out.tif  stdout.txt 2 stderr.txt

Regards,

Ivan

  
  Thanks
  Sam
  --
  NEU: Mit GMX DSL über 1000,- ¿ sparen!
  http://portal.gmx.net/de/go/dsl02
  ___
  gdal-dev mailing list
  gdal-dev@lists.osgeo.org
  http://lists.osgeo.org/mailman/listinfo/gdal-dev
  
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] Oracle OCI connection in Python OGR

2010-02-12 Thread Abhay
On Fri, Feb 12, 2010 at 2:48 PM, Eric Wolf ebw...@gmail.com wrote:

 I'm using GDAL/OGR 1.6.1 with ActivePython 2.6.4-10 and
 cx_Oracle-5.0.3-11g. I am trying to connect to an Oracle 11g instance.

 This works:

 ogr2ogr -f KML emp.kml OCI:scott/tiger EMP

 What am I doing wrong. This fails, ds is None:

 from osgeo import ogr

 try:
 d = ogr.GetDriverByName('OCI')
 except:
 print Unable to GetDriverByName
 quit()

 ds = None

 try:
 ds = ogr.Open('OCI:scott/tiger')
 except:
 print Unable to open OCI connection
 quit()

 if ds is None:
 print Unable to open Oracle connection, ds
 quit()

 lyr = ds.GetLayerByName('EMP')
 number = lyr.GetFeatureCount()

 print Features:  + str(number)




 -=--=---===---=--=-=--=---==---=--=-=-
 Eric B. WolfNew! 720-334-7734
 USGS Geographer
 Center of Excellence in GIScience
 PhD Student
 CU-Boulder - Geography

 GPG Public Key: http://www.h4h.net/ebwolf.public.key.txt

 ___
 gdal-dev mailing list
 gdal-dev@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/gdal-dev


Hi Eric,

Form your mail it not clear what is cause of the problem.

There 2 scenario here

1) you are on a remote machine form where your trying to connect oracle
server machine:

a) Have you installed any Oracle Client in your system. Considering that you
are using the complete oracle client installation you can use the following
 :
OCI:scott/tiger@Tnsname entry for eg. ORCL

b) if you are trying out with Instant client for 11g you should try either
of the following

OCI:scott/tiger@//localhost/your ORACLE SERVICE IDENTIFIER for eg ORCL.

2) you are on the oracle server machine where

you must set the oracle SID. like the following
on windows
SET ORACLE_SID=ORCL
or
on *nix
export ORACLE_SID=ORCL

then try your implementation or use methods stated in 1)




Rgds.

Abhay.
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: [gdal-dev] How to supress std io of gdal?

2010-02-12 Thread Joaquim Luis


I have also reported troubles of this type that unfortunately slipped 
across the last two gdal releases without being addressed.


http://trac.osgeo.org/gdal/ticket/3195

Here the problem is even worst as the errors are print to stdout

Joaquim Luis


Sam,

   

  Is there a way to redirect it to some other buffer? Like an internal stream 
which can then be properly propagated via exceptions or written into a log?
 

It is probably not as sophisticated as you want or need but have you tried that:

gdalinfo out.tif  stdout.txt 2  stderr.txt

Regards,

Ivan

   


  Thanks
  Sam
  --
  NEU: Mit GMX DSL über 1000,- ¿ sparen!
  http://portal.gmx.net/de/go/dsl02
  ___
  gdal-dev mailing list
  gdal-dev@lists.osgeo.org
  http://lists.osgeo.org/mailman/listinfo/gdal-dev

 

___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


   


___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] How to supress std io of gdal?

2010-02-12 Thread Ari Jolma

Sam,

There is CPLSetErrorHandler, which you can use to set your own error 
handler function:


http://www.gdal.org/ogr/cpl__error_8h.html#74d0e649d58180e621540bf73b58e4a2

This is used for example by the HL bindings to redirect warnings and 
errors to respective systems of the HLs. See:


http://trac.osgeo.org/gdal/browser/trunk/gdal/swig/include/cpl_exceptions.i

Regards,

Ari

ariasg...@gmx.de wrote:

Hello,
I've been looking into the docs and also into the source without much luck.
When it comes to error handling, functions like GDALOpen just dump everything 
to the console when reading file error or similar things occur.

Is this customizable? GDAL is deeply burried in the logic-code part of our code 
which is not supposed to break the architecture by dumping unwanted information 
to the console or whatever is tied to the output stream.
Is there a way to redirect it to some other buffer? Like an internal stream 
which can then be properly propagated via exceptions or written into a log?

Thanks
Sam
  


___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] ECW driver as a plugin

2010-02-12 Thread Jason Beverage
Awesome, thanks for the info Even!

Jason

On Wed, Feb 10, 2010 at 3:27 PM, Even Rouault
even.roua...@mines-paris.org wrote:
 In case it might interest you, the UbuntuGIS team packages a GDAL ECW plugin :

 https://launchpad.net/~ubuntugis/+archive/ppa/

 Le Wednesday 10 February 2010 19:28:08 Jason Beverage, vous avez écrit :
 Hi Frank,

 By official version of the plugin I meant the definitive source.  I
 would have expected to find the ECW plugin as part of GDAL itself, or
 downloadable from the GDAL website rather than going through GRASS to
 get the GDAL ECW plugin.  Just wanted to make sure I was getting the
 plugin from the right place.

 Thanks,

 Jason

 On Wed, Feb 10, 2010 at 12:59 PM, Frank Warmerdam warmer...@pobox.com
 wrote:
  Jason Beverage wrote:
  Hi all,
 
  I'm exploring different methods of deploying GDAL with ECW support and
  saw various posts about building ECW support as a plugin vs including
  it within the build.  I found the GDAL ECW plugin and instructions
  here (http://home.prea.net/node/79) but the source is from the GRASS
  project.  I tried it out with GDAL 1.6.3 and it seemed to work great.
  Is this the official GDAL ECW plugin?
 
  Jason,
 
  The approach described seems fine, but the project does not produce
  official
  binaries for linux itself, and so there is no official version of the
  plugin.
 
  Best regards,
  --
  ---+-
 - I set the clouds in motion - turn up   | Frank Warmerdam,
  warmer...@pobox.com
  light and sound - activate the windows | http://pobox.com/~warmerdam
  and watch the world go round - Rush    | Geospatial Programmer for Rent

 ___
 gdal-dev mailing list
 gdal-dev@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/gdal-dev



___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] Oracle OCI connection in Python OGR

2010-02-12 Thread Eric Wolf
Thanks for the replies. Sorry I didn't give more details on the environment.

I am running on Windows, at the command line, both ogr2ogr and the python
script.

Created an environment variable for ORACLE_SID=ORCL

I double-checked my OCI string by using sqlplus to connect:

sqlplus scott/ti...@orcl

This works fine. I changed the script to use that in the call to ogr.Open().
No luck.

I imported gdal and sprinkled print 'Error:', gdal.GetLastErrorMsg() in my
exception handlers. I got:

Unable to open Oracle connection None
Error:

Still no dice. If I take the same script and modify the GetDriverByName and
Open to use a shapefile, it works perfectly.

-Eric



-=--=---===---=--=-=--=---==---=--=-=-
Eric B. WolfNew! 720-334-7734
USGS Geographer
Center of Excellence in GIScience
PhD Student
CU-Boulder - Geography

GPG Public Key: http://www.h4h.net/ebwolf.public.key.txt


On Fri, Feb 12, 2010 at 6:56 AM, Abhay abhay.me...@gmail.com wrote:



 On Fri, Feb 12, 2010 at 2:48 PM, Eric Wolf ebw...@gmail.com wrote:

 I'm using GDAL/OGR 1.6.1 with ActivePython 2.6.4-10 and
 cx_Oracle-5.0.3-11g. I am trying to connect to an Oracle 11g instance.

 This works:

 ogr2ogr -f KML emp.kml OCI:scott/tiger EMP

 What am I doing wrong. This fails, ds is None:

 from osgeo import ogr

 try:
 d = ogr.GetDriverByName('OCI')
 except:
 print Unable to GetDriverByName
 quit()

 ds = None

 try:
 ds = ogr.Open('OCI:scott/tiger')
 except:
 print Unable to open OCI connection
 quit()

 if ds is None:
 print Unable to open Oracle connection, ds
 quit()

 lyr = ds.GetLayerByName('EMP')
 number = lyr.GetFeatureCount()

 print Features:  + str(number)




 -=--=---===---=--=-=--=---==---=--=-=-
 Eric B. WolfNew! 720-334-7734
 USGS Geographer
 Center of Excellence in GIScience
 PhD Student
 CU-Boulder - Geography

 GPG Public Key: http://www.h4h.net/ebwolf.public.key.txt

 ___
 gdal-dev mailing list
 gdal-dev@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/gdal-dev


 Hi Eric,

 Form your mail it not clear what is cause of the problem.

 There 2 scenario here

 1) you are on a remote machine form where your trying to connect oracle
 server machine:

 a) Have you installed any Oracle Client in your system. Considering that
 you are using the complete oracle client installation you can use the
 following  :
 OCI:scott/tiger@Tnsname entry for eg. ORCL

 b) if you are trying out with Instant client for 11g you should try either
 of the following

 OCI:scott/tiger@//localhost/your ORACLE SERVICE IDENTIFIER for eg ORCL.

 2) you are on the oracle server machine where

 you must set the oracle SID. like the following
 on windows
 SET ORACLE_SID=ORCL
 or
 on *nix
 export ORACLE_SID=ORCL

 then try your implementation or use methods stated in 1)




 Rgds.

 Abhay.

___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

[gdal-dev] OGDI -- GDAL

2010-02-12 Thread Harsh Govind
I am trying to compile the OGDI library so that I may use it from within GDAL 
to read VPF data. I downloaded the code but seems like all the makefiles are 
setup for VC++ 6.0 in Win32 environment. All my other dlls are in VC++8.0.

Has anyone compiled OGDI in VS2005? How can I build OGDI with VS8.0? Thanks in 
advance.

Regards,
Harsh Govind


___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: [gdal-dev] OGDI -- GDAL

2010-02-12 Thread Frank Warmerdam

Harsh Govind wrote:
I am trying to compile the OGDI library so that I may use it from within 
GDAL to read VPF data. I downloaded the code but seems like all the 
makefiles are setup for VC++ 6.0 in Win32 environment. All my other dlls 
are in VC++8.0.


 

Has anyone compiled OGDI in VS2005? How can I build OGDI with VS8.0? 
Thanks in advance.


Harsh,

I have had no problem building OGDI with VS2003, and I see no reason that
VS2005 or even VS2008 Express shouldn't work well.  One issue that isn't
addressed in the makefiles is doing anything about manifests.  You may find
it helpful to manually incorporate manifests into the DLLs using something
like:

mt -manifest abc.dll.manifest -outputresource:abc.dll;2

Best regards,
--
---+--
I set the clouds in motion - turn up   | Frank Warmerdam, warmer...@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush| Geospatial Programmer for Rent

___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


[gdal-dev] Re: Motion: Extend Commit Access to Gaige Paulsen

2010-02-12 Thread Frank Warmerdam

Frank Warmerdam wrote:

Motion: Extend GDAL/OGR Commit Access to Gaige Paulsen.


Folks,

I declare this motion passed with support from Daniel, Even, Tamas, Howard
and myself.  Welcome aboard Gaige!

Best regards,
--
---+--
I set the clouds in motion - turn up   | Frank Warmerdam, warmer...@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush| Geospatial Programmer for Rent

___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev