Skip to content

Commit

Permalink
[processing] fixed split vector layer algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
volaya committed Dec 22, 2014
1 parent 6c7d61f commit 247c3dd
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions python/plugins/processing/algs/qgis/VectorSplit.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@

__revision__ = '$Format:%H$'

import os
from PyQt4.QtCore import *
from qgis.core import *
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.parameters import ParameterVector
from processing.core.parameters import ParameterTableField
from processing.core.outputs import OutputDirectory
from processing.tools import dataobjects, vector

from processing.tools.system import mkdir

class VectorSplit(GeoAlgorithm):

Expand All @@ -54,18 +55,13 @@ def processAlgorithm(self, progress):
layer = dataobjects.getObjectFromUri(
self.getParameterValue(self.INPUT))
fieldName = self.getParameterValue(self.FIELD)

directory = self.getOutputValue(self.OUTPUT)

if directory.find('\\') != -1:
directory.replace('\\', '/')

if not directory.endswith("/"):
directory += '/'
mkdir(directory)

fieldIndex = layer.fieldNameIndex(fieldName)
uniqueValues = vector.uniqueValues(layer, fieldIndex)
baseName = '{0}{1}_{2}'.format(directory, layer.name(), fieldName)
baseName = os.path.join(directory, '{0}_{1}'.format(layer.name(), fieldName))

fields = layer.pendingFields()
crs = layer.dataProvider().crs()
Expand Down

0 comments on commit 247c3dd

Please sign in to comment.