Thank you guys and sorry for the late reply! I will test these options on my data.
Silvia On Thu, Oct 20, 2016 at 10:30 AM, Antonio Falciano < antonio.falci...@gmail.com> wrote: > Il 18/10/2016 18:13, Óscar Martínez ha scritto: > >> Hi Silvia, >> >> Sorry with our last emails I forgot this one. >> >> So this two quick scripts: >> >> - a 2D point layer with a column of z of which I would create a 3D point >> layer >> > > [...] > > - a 2D line layer with a column containing the elevation of each corner >> of the line which I would create a 3D line layer. >> (*This script will be useful for lines and for polygons*, becouse their >> geometry works in the same way) >> > > [...] > > > Hi all, > alternatively, as stated in my first post, it's possible to use only one > script for all types of geometries (and eventually for other layer > formats different from ESRI Shapefile) using ogr2ogr: > > # encoding: utf-8 > > from gvsig import * > import os > > from gvsig import uselib > uselib.use_plugin("org.gvsig.gdal.app.mainplugin") > from org.gvsig.gdal.app.mainplugin.common import ogr2ogr > > def main(*args): > > layer = currentLayer() > zfield = "ID" > if layer != None: > # get the input layer path (2D) > datastore = layer.getDataStore() > inLayerPath = datastore.getFullName() > > # get the output layer path (3D) > dirname = os.path.dirname(inLayerPath) > filename = os.path.basename(inLayerPath).split(".")[0] > # for instance, we use the same file extension of the input layer > # but it could be another OGR format (e.g. SpatiaLite) > extension = os.path.basename(inLayerPath).split(".")[1] > outLayerPath = os.path.join(dirname, filename + "_3D." + extension) > > if extension.lower() == "shp": > format = "ESRI Shapefile" > #elif extension.lower() == "..." > # format = "..." > else: > print "Not implemented yet!" > > ogr2ogr.main(["-f", format, > outLayerPath, > inLayerPath, > "-zfield", zfield, > "-overwrite" > ]) > > loadShapeFile(outLayerPath) > > > Cheers, > Antonio > > -- > Antonio Falciano > http://www.linkedin.com/in/antoniofalciano > _______________________________________________ > Gvsig_internacional mailing list > Gvsig_internacional@listserv.gva.es > > To see the archives, edit your preferences or unsubscribe from this > mailing list, please access this url: > > https://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional > -- ing. Silvia Franceschi Via Latemar, 22 38030 Castello di Fiemme (TN) tel: 0039 -3384501332
_______________________________________________ Gvsig_internacional mailing list Gvsig_internacional@listserv.gva.es To see the archives, edit your preferences or unsubscribe from this mailing list, please access this url: https://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional