def newLayer(layer, path, geometryType): #path = "C:/gvsig/test03.shp" CRS= gvsig.currentProject().getProjectionCode() schema = gvsig.createSchema(layer.getSchema()) output = gvsig.createShape( schema, path, CRS=CRS, geometryType = geometryType ) gvsig.currentView().addLayer(output) return output
def newLayer(layer, path, geometryType=None): CRS = layer.getProjectionCode() schema = gvsig.createSchema(layer.getSchema()) if geometryType==None: geometryType = layer.getTypeVectorLayer().getType() output = gvsig.createShape( schema, path, CRS=CRS, geometryType=geometryType ) gvsig.currentView().addLayer(output) return output
def newLayer(layer, path, geometryType): #path = "C:/gvsig/test03.shp" CRS = gvsig.currentProject().getProjectionCode() schema = gvsig.createSchema(layer.getSchema()) output = gvsig.createShape(schema, path, CRS=CRS, geometryType=geometryType) gvsig.currentView().addLayer(output) return output
def newLayer(layer, path, geometryType=None): CRS = layer.getProjectionCode() schema = gvsig.createSchema(layer.getSchema()) if geometryType == None: geometryType = layer.getTypeVectorLayer().getType() output = gvsig.createShape(schema, path, CRS=CRS, geometryType=geometryType) gvsig.currentView().addLayer(output) return output
def addField(layer,field, sType = "STRING",iSize=20): #IN: layer, field, *sType, *iSize) #OUT: layer #addField(layer, "nombre") schema = gvsig.createSchema(layer.getSchema()) schema.modify() if isinstance(field,str): schema.append(field,sType,iSize) layer.edit() layer.updateSchema(schema) layer.commit() print "Add field ", field, " to ", layer.name return layer
def addField(layer, field, sType="STRING", iSize=20): #IN: layer, field, *sType, *iSize) #OUT: layer #addField(layer, "nombre") schema = gvsig.createSchema(layer.getSchema()) schema.modify() if isinstance(field, str): schema.append(field, sType, iSize) layer.edit() layer.updateSchema(schema) layer.commit() print "Add field ", field, " to ", layer.name return layer
def checkErrorsLayer(self, line): errorsLayer = gvsig.currentView().getLayer(self.errorsLayerName) if errorsLayer == None: errorsLayerSchema = gvsig.createSchema() errorsLayerSchema.append("GEOMETRY", "GEOMETRY") errorsLayerSchema.get("GEOMETRY").setGeometryType(geom.POINT, geom.D2) errorsLayer = gvsig.createShape(errorsLayerSchema) errorsLayer.setName(self.errorsLayerName) errorsLegend = SingleSymbolLegend() errorsSymbol = SimpleMarkerSymbol() errorsSymbol.setColor(gvsig.utils.getColorFromRGB(255, 0, 51)) # RGB errorsSymbol.setSize(10) errorsLegend.setDefaultSymbol(errorsSymbol) errorsLayer.setLegend(errorsLegend) gvsig.currentView().addLayer(errorsLayer)