[gdal-dev] Convert kml to Shapefile and conserve polygon's colors with Ogr2Ogr

2012-10-22 Thread Wael Tarhouni
Hi All,

I'm using Ogr2Ogr to convert kml file to shapefile but the color of the
shape output file is unique, i 'm always loosing the colors of my polygons
 in the shapefile...

is there any way to solve this problem ?

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] Convert kml to Shapefile and conserve polygon's colors with Ogr2Ogr

2012-10-22 Thread xavier lhomme
Hi
There is no graphical representation in the shapefile.
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: [gdal-dev] Convert kml to Shapefile and conserve polygon's colors with Ogr2Ogr

2012-10-22 Thread Chaitanya kumar CH
Wael,

There is no support for style information in shapefile format. However, you
can store the style info as a regular attribute value. Using OGR's SQL you
can extract the style string from the kml data and then store it in the
shapefile. Please go through the OGR SQL page[1]. You can get the style
from the special field named OGR_STYLE.

[1]: http://www.gdal.org/ogr/ogr_sql.html

On Mon, Oct 22, 2012 at 2:25 PM, Wael Tarhouni waelin...@gmail.com wrote:

 Hi All,

 I'm using Ogr2Ogr to convert kml file to shapefile but the color of the
 shape output file is unique, i 'm always loosing the colors of my polygons
  in the shapefile...

 is there any way to solve this problem ?

 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




-- 
Best regards,
Chaitanya kumar CH.

+91-9494447584
17.2416N 80.1426E
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: [gdal-dev] Convert kml to Shapefile and conserve polygon's colors with Ogr2Ogr

2012-10-22 Thread Smith, Michael ERDC-CRREL-NH
Wael,

First, make sure you are using the libkml driver and not the kml driver.
The libkml driver can read the style information. Then you can get that
information in your shapefile by specifically requesting the ogr_style
column.

Try adding 

-sql 'select *, ogr_style as style from Layer0'

Mike

-- 
Michael Smith

US Army Corps
Remote Sensing GIS/Center




From:  Wael Tarhouni waelin...@gmail.com
Date:  Monday, October 22, 2012 4:55 AM
To:  gdal-dev@lists.osgeo.org gdal-dev@lists.osgeo.org
Subject:  [gdal-dev] Convert kml to Shapefile and conserve polygon's
colors  with Ogr2Ogr
Resent-From:  Michael Smith michael.sm...@usace.army.mil


Hi All,

I'm using Ogr2Ogr to convert kml file to shapefile but the color of the
shape output file is unique, i 'm always loosing the colors of my polygons
 in the shapefile...

is there any way to solve this problem ?

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


[gdal-dev] How to use gdal_polygonize.py

2012-10-22 Thread Paul Meems
Hi all,

I'm investigating gdal_polygonize.py
I'm thinking of using it to convert a DEM-file to a polygon shapefile.

I did a quick test using gdal_polygonize.py logan.tif -f ESRI Shapefile
logan_poly.shp and got a shapefile.
But this shapefile is huge, it created a polygon for every pixel value.

I was thinking it would be a bit more like gdal_contour which uses an
interval.

Am I not understanding the purpose of gdal_polygonize?
Can somebody tell me some real-life use cases when to use this?

Thanks,

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

[gdal-dev] Can't create feature on layer for polygon

2012-10-22 Thread Hugo Benicio
Hi guys!

I'm trying to create a shapefile containing a single polygon, but
unfortunately I'm facing an error that I have no clue how to solve.
I'm successfuly creating a datasource and a layer with:

OGRLayer* testLayer = newDataSource-CreateLayer(test,NULL, wkbPolygon,
NULL);

Then when I try to create a feature containing a *previously
calculated**polygon like this:

OGRFeature* feature = OGRFeature::CreateFeature(testLayer-GetLayerDefn());
feature-SetGeometry(myPolygon);
OGRErr errorCode = testLayer-CreateFeature(feature);

The line 'testLayer-CreateFeature(feature)' fails returning the error code:
OGRERR_UNSUPPORTED_GEOMETRY_TYPE 3

What am I missing here? How can I make my geometry type supported? Any
clues?
Maybe I have to set the geometry type somehow somewhere else (on the layer
or the geometry definition)... I don't know...

*(*) *FYI, 'myPolygon' is generated with the Intersection of other 2
Polygons
OGRGeometry *myPolygon = basinPolygon-Intersection(landscapePolygon);

Thanks in Advance,
Best Regards,
Hugo Benício.
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: [gdal-dev] How to use gdal_polygonize.py

2012-10-22 Thread Ari Jolma

On 10/22/2012 12:38 PM, Paul Meems wrote:


Am I not understanding the purpose of gdal_polygonize?
Can somebody tell me some real-life use cases when to use this?


Land cover classification rasters can have large areas of the same 
(integer) value. I've used the GDAL polygonize code for such rasters.


Ari

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


Re: [gdal-dev] Can't create feature on layer for polygon

2012-10-22 Thread Hugo Benicio
Ok, I've discovered that myPolygon has geometryType *wkbGeometryCollection.*
When I try to:
newDataSource-CreateLayer(test,NULL, *wkbGeometryCollection*, NULL);
it fails and returns NULL.

So my question now is: How do I create a wkbGeometryCollection layer (if
possible) or how do I correctly change the geometry type of my geometry
(from *wkbGeometryCollection *to *wkbPolygon*)?
*
*
Thanks in advance,
Hugo Benício.

*
*
On Mon, Oct 22, 2012 at 11:24 AM, Hugo Benicio hbobeni...@gmail.com wrote:

 Hi guys!

 I'm trying to create a shapefile containing a single polygon, but
 unfortunately I'm facing an error that I have no clue how to solve.
 I'm successfuly creating a datasource and a layer with:

 OGRLayer* testLayer = newDataSource-CreateLayer(test,NULL, wkbPolygon,
 NULL);

 Then when I try to create a feature containing a *previously 
 calculated**polygon like this:

 OGRFeature* feature = OGRFeature::CreateFeature(testLayer-GetLayerDefn());
 feature-SetGeometry(myPolygon);
 OGRErr errorCode = testLayer-CreateFeature(feature);

 The line 'testLayer-CreateFeature(feature)' fails returning the error
 code:
 OGRERR_UNSUPPORTED_GEOMETRY_TYPE 3

 What am I missing here? How can I make my geometry type supported? Any
 clues?
 Maybe I have to set the geometry type somehow somewhere else (on the layer
 or the geometry definition)... I don't know...

 *(*) *FYI, 'myPolygon' is generated with the Intersection of other 2
 Polygons
 OGRGeometry *myPolygon = basinPolygon-Intersection(landscapePolygon);

 Thanks in Advance,
 Best Regards,
 Hugo Benício.

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

Re: [gdal-dev] Can't create feature on layer for polygon

2012-10-22 Thread Hugo Benicio
For anyone else having the same problem like mine,
I solved my issue just iterating over the wkbGeometryCollection, gathering
all polygons in it and creating a feature for the my layer for each of them.

On Mon, Oct 22, 2012 at 1:31 PM, Hugo Benicio hbobeni...@gmail.com wrote:

 Ok, I've discovered that myPolygon has geometryType *
 wkbGeometryCollection.*
 When I try to:
 newDataSource-CreateLayer(test,NULL, *wkbGeometryCollection*,
 NULL);
 it fails and returns NULL.

 So my question now is: How do I create a wkbGeometryCollection layer (if
 possible) or how do I correctly change the geometry type of my geometry
 (from *wkbGeometryCollection *to *wkbPolygon*)?
 *
 *
 Thanks in advance,
 Hugo Benício.

 *
 *
 On Mon, Oct 22, 2012 at 11:24 AM, Hugo Benicio hbobeni...@gmail.comwrote:

 Hi guys!

 I'm trying to create a shapefile containing a single polygon, but
 unfortunately I'm facing an error that I have no clue how to solve.
 I'm successfuly creating a datasource and a layer with:

 OGRLayer* testLayer = newDataSource-CreateLayer(test,NULL, wkbPolygon,
 NULL);

 Then when I try to create a feature containing a *previously 
 calculated**polygon like this:

 OGRFeature* feature =
 OGRFeature::CreateFeature(testLayer-GetLayerDefn());
 feature-SetGeometry(myPolygon);
 OGRErr errorCode = testLayer-CreateFeature(feature);

 The line 'testLayer-CreateFeature(feature)' fails returning the error
 code:
 OGRERR_UNSUPPORTED_GEOMETRY_TYPE 3

 What am I missing here? How can I make my geometry type supported? Any
 clues?
 Maybe I have to set the geometry type somehow somewhere else (on the
 layer or the geometry definition)... I don't know...

 *(*) *FYI, 'myPolygon' is generated with the Intersection of other 2
 Polygons
 OGRGeometry *myPolygon = basinPolygon-Intersection(landscapePolygon);

 Thanks in Advance,
 Best Regards,
 Hugo Benício.



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