Skip to content

Instantly share code, notes, and snippets.

@oscar9
Created March 24, 2017 13:26
Show Gist options
  • Save oscar9/43523df6c76056cbde97f4a23f967ffe to your computer and use it in GitHub Desktop.
Save oscar9/43523df6c76056cbde97f4a23f967ffe to your computer and use it in GitHub Desktop.
Create temp layers in gvpy for gvSIG geoprocesses #gvsig #geoprocessing
# encoding: utf-8
import gvsig
from gvsig import *
from gvsig.libs import gvpy
reload(gvpy)
import os
def main(*args):
gvpy.algHelp("gvSIG-reproject")
"""
* Algorithm help: Reproyeccion
* Usage: runalg( "gvSIG-reproject",
LAYER[Vector Layer],
SELECTED_GEOM[Boolean],
DST_PROJECTION[String],
RESULT_POL[output vector layer],
RESULT_LINE[output vector layer],
RESULT_POINT[output vector layer],
);
"""
#Funtion tempfile
n1 = getTempFile("new", ".shp")
print n1
#C:\Users\Versus\AppData\Local\Temp\/tmp-andami\new-58d51c6267b.shp
n2 = getTempFile("new", ".shp", r"C:\resultados")
print n2
#C:\resultados\new-58d51c62686.shp
# Ejemplo
shp1 = gvpy.runalg("randomvector",10,0)
shp2 = gvpy.runalg("gvSIG-reproject", shp1, "false", "EPSG:25829", PATH=[getTempFile("new1", ".shp"),getTempFile("new2", ".shp"),getTempFile("new3", ".shp")])
print shp2
# Salida multiple en forma de lista: [new1-58d51c7f20ed, new2-58d51c7f20ed, new3-58d51c7f20ed]
print shp2[0].getGeometryType().getName()
print shp2[1].getGeometryType().getName()
print shp2[2].getGeometryType().getName()
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment