[gdal-dev] ogr2ogr: create a new shapefile with some math

Chaitanya kumar CH chaitanya.ch at gmail.com
Tue Jul 19 06:54:36 EDT 2011


Candini,

You can use the -sql option with the ogr2ogr utility. You can find further
details of OGR's SQL capabilities in the RFC28 [1]. It also shows an example
with arithmetic operations.

Tell us how it worked.

[1]: http://trac.osgeo.org/gdal/wiki/rfc28_sqlfunc

On Tue, Jul 19, 2011 at 3:24 PM, canduc17 <candini at meeo.it> wrote:

> Hi everyone. I have a shape file with the following characteristics:
> INFO: Open of `faggete.shp'
>      using driver `ESRI Shapefile' successful.
>
> Layer name: faggete
> Geometry: Polygon
> Feature Count: 833
> Extent: (341942.975384, 4732949.828158) - (365163.422399, 4773205.622984)
> Layer SRS WKT:
> (unknown)
> FID_fagget: Integer (9.0)
> SUP_HA: Real (19.15)
> STRINGA: String (11.0)
> TF: String (11.0)
> CV: String (11.0)
> AX: String (11.0)
> DE: String (11.0)
> INR: String (11.0)
> P: String (11.0)
> TIPIFORE: String (11.0)
> INT: String (11.0)
> ATTRIBUTI: String (25.0)
> COD_UNIV: String (50.0)
> area_ha: Real (19.9)
> FID_comuni: Integer (9.0)
> NOME_COM: String (50.0)
> NumHa: Real (19.11)
> VolHa: Real (19.11)
> Y_planted: Real (19.11)
> Eta: Real (19.11)
> Ws: Real (19.11)
> Biomassa_e: Real (19.11)
> Wr: Real (19.11)
> Wf: Real (19.11)
>
>
> I need to create a new vector file applying mathematical operations to some
> field.
> For example, let's say I have to double up every value of NumHa and sum
> this
> result to every value of VolHa.
> And I have to insert these new values (for NumHa and VolHa) inside the new
> vector.
> How can I achieve this?
> Is that possible with ogr2ogr?
>
> Thanks in advance...
>
> --
> View this message in context:
> http://osgeo-org.1803224.n2.nabble.com/ogr2ogr-create-a-new-shapefile-with-some-math-tp6598180p6598180.html
> Sent from the GDAL - Dev mailing list archive at Nabble.com.
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>



-- 
Best regards,
Chaitanya kumar CH.

+91-9494447584
17.2416N 80.1426E
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110719/7244caf5/attachment-0001.html


More information about the gdal-dev mailing list