Re: [gdal-dev] OGRGeometry::Intersection returns NULL

2012-10-16 Thread Alisson Barbosa
Solved! The problem was because my GDAL/OGR had not been compiled with GEOS.

2012/10/10 Even Rouault even.roua...@mines-paris.org

 Le mercredi 10 octobre 2012 19:48:07, Alisson Barbosa a écrit :
  Hello, guys!
 
  I'm truggling through a rough moment here...
  I have this piece of code in a project that I work on:
 
  if(basinPolygon-Intersects(luPolygon))
  {
  OGRGeometry *result = basinPolygon-Intersection(luPolygon);
  if(result)
  newLayer.push_back(result);
  }
 
  Somehow, the Intersects function returns true for those polygons
  (basinPolygon and luPolygon) (i.e. there is a intersection area between
  them), but
 
  basinPolygon-Intersection(luPolygon);
 
  Always returns NULL! why is it returning NULL if Intersects returns
 true?!
  This is a mistery for me!

 The likely cause is documented in the page you quoted

 About Intersection(): This method is built on the GEOS library, check it
 for
 the definition of the geometry operation. If OGR is built without the GEOS
 library, this method will always fail, issuing a CPLE_NotSupported error.

 About Intersects(): If GEOS is enabled, then this is done in rigerous
 fashion
 otherwise TRUE is returned if the envelopes (bounding boxes) of the two
 features overlap.

 Take your symptoms and the above highlighted precisions, and you should
 have
 the answer.




-- 
Alisson Barbosa
Systems Analyst - FUNCEME
M.Sc. in Computer Science - MACC
Graduate in Computer Science  - UECE
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

[gdal-dev] Import Shape file to PostGIS with Talend

2012-10-16 Thread Wael Tarhouni
Hi All;

I'm tryin ti import a shapefile to a postgis database via the spatial
component of Talend Data Integrator, so i have always the same error: no
metadata found (metadata of the shapefile)
so how can i get the metadata of the shapefile.

NB: I had imported a shapefile into a postgis database with ogr2ogr
succesfully but i wanna make it automatic now with Talend ;)


Best regards;

-- 
Wael Tarhouni
Élève ingénieur en Réseaux informatiques et Télecommunication à l'INSAT
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: [gdal-dev] Help on using Ogr2ogr to load dxf data to postgis

2012-10-16 Thread Pietro Rossin
After googlin' around I get an answer myself..

This is the string I use to load a dxf file to postgis without any Layer
that begin with X:

ogr2ogr --config DXF_INLINE_BLOCKS FALSE --config DXF_MERGE_BLOCK_GEOMETRIES
FALSE -f PostgreSQL PG:host=localhost user=postgres dbname=mydb
password=myPassw mydxf.dxf -where Layer NOT LIKE 'X%' -overwrite entities

bie
Pietro



--
View this message in context: 
http://osgeo-org.1560.n6.nabble.com/Help-on-using-Ogr2ogr-to-load-dxf-data-to-postgis-tp5008635p5009002.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


[gdal-dev] ORA-01406 error when reading many attributes from Oracle

2012-10-16 Thread Jukka Rahkonen
Hi,

I have one view in Oracle 11 that I just cannot convert to another format with
ogr2ogr.

If I use -sql parameter SELECT * FROM view the conversion stops after couple
of thousands of lines with the following error

ERROR 1: ORA-01406: fetched column value was truncated
 in OCIStmtFetch

I found this explanation from internet

ORA-01406:  fetched column value was truncated
Cause:  In a host language program, a FETCH operation was forced to truncate a
character string. The program buffer area for this column was not large enough
to contain the entire string. The cursor return code from the fetch was +3.
Action: Increase the column buffer area to hold the largest column value or
perform other appropriate processing. 

Could it be possible that OCI driver reserves too little of some resourses and
fails because of that with large records?  I am now running a query with minimum
set of columns in my query and ogr2ogr is running well and I believe it will
convert all the million rows from the view now.

The view schema does not look extra hard for me. There are 21 attributes in the
view and the longest VARCHAR2 is just 100 chararters long.

-Jukka Rahkonen-

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


Re: [gdal-dev] ORA-01406 error when reading many attributes from Oracle

2012-10-16 Thread Eli Adam
Jukka,

 Could it be possible that OCI driver reserves too little of some resourses and
 fails because of that with large records?  I am now running a query with 
 minimum
 set of columns in my query and ogr2ogr is running well and I believe it will
 convert all the million rows from the view now.

 The view schema does not look extra hard for me. There are 21 attributes in 
 the
 view and the longest VARCHAR2 is just 100 chararters long.

This may be overly simplistic, but does the cast operator do anything?

SELECT *, CAST(OGR_STYLE AS character(255)) FROM rivers

Eli


 -Jukka Rahkonen-

 ___
 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] Setting DataType in ReadAsArray

2012-10-16 Thread Antonio Falciano

Il 16/10/2012 22.05, elli...@cpi.com ha scritto:

Hello,

Does anybody know of a way to set the data type in the call ReadAsArray.
It is currently reading a field as an unsigned int and it needs to be read
as a signed int.


Hi,
ReadAsArray returns substantially a numpy array, so you can use np
functions and methods of conversions between data types [1]. Finally,
the simplest way consists into using the .astype() method. Hope this helps!

Cheers,
Antonio

[1] http://docs.scipy.org/doc/numpy/user/basics.types.html

--
Antonio Falciano
http://www.linkedin.com/in/antoniofalciano
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] Setting DataType in ReadAsArray

2012-10-16 Thread elliott
 Il 16/10/2012 22.05, elli...@cpi.com ha scritto:
 Hello,

 Does anybody know of a way to set the data type in the call ReadAsArray.
 It is currently reading a field as an unsigned int and it needs to be
 read
 as a signed int.

 Hi,
 ReadAsArray returns substantially a numpy array, so you can use np
 functions and methods of conversions between data types [1]. Finally,
 the simplest way consists into using the .astype() method. Hope this
 helps!

 Cheers,
 Antonio

 [1] http://docs.scipy.org/doc/numpy/user/basics.types.html

 --
 Antonio Falciano
 http://www.linkedin.com/in/antoniofalciano
 ___
 gdal-dev mailing list
 gdal-dev@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/gdal-dev


Thanks, perfect!  Exactly what I was looking for.
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] Setting DataType in ReadAsArray

2012-10-16 Thread Chris Barker
On Tue, Oct 16, 2012 at 1:59 PM, Antonio Falciano afalci...@yahoo.it wrote:

 Does anybody know of a way to set the data type in the call ReadAsArray.
 It is currently reading a field as an unsigned int and it needs to be read
 as a signed int.

 ReadAsArray returns substantially a numpy array, so you can use np
 functions and methods of conversions between data types [1]. Finally,
 the simplest way consists into using the .astype() method. Hope this helps!

Actually you probably don't want that -- .astype() does a type
conversion, and what you want is to interpret the data in a different
way -- you can use .view for that -- somethign like:

arr =... ReadAsArray(...)

arr2 = arr.view(dtype=np.int32) # or the appropriate type.

that will create a new array that points to the same data buffer, but
interpretting the buffer as the new type

though I'd think ReadAsArray would get it right

-Chris


 Cheers,
 Antonio

 [1] http://docs.scipy.org/doc/numpy/user/basics.types.html

 --
 Antonio Falciano
 http://www.linkedin.com/in/antoniofalciano

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



-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/ORR(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

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