Skip to content

Commit

Permalink
[needs-docs] Rename "Define layer projection" to "Define Shapefile pr…
Browse files Browse the repository at this point in the history
…ojection"

This algorithm ONLY works on shapefile inputs, so make that clear in the algorithm's
display name and helper strings
  • Loading branch information
nyalldawson committed Feb 4, 2020
1 parent dae36b3 commit 692a140
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/help/qgis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ qgis:createpointslayerfromtable: >
This algorithm creates points layer from a table with columns that contain coordinates fields. Besides X and Y coordinates you can also specify Z and M fields.

qgis:definecurrentprojection: >
This algorithm sets an existing layer's projection to the provided CRS. Contrary to the "Assign projection" algorithm, it will not output a new layer.
This algorithm sets an existing Shapefile's projection to the provided CRS. Contrary to the "Assign projection" algorithm, it will not output a new layer.

For shapefile datasets, the .prj and .qpj files will be overwritten - or created if missing - to match the provided CRS.
The .prj and .qpj files associated with the Shapefile will be overwritten - or created if missing - to match the provided CRS.

qgis:delaunaytriangulation: >
This algorithm creates a polygon layer with the delaunay triangulation corresponding to a points layer.
Expand Down
14 changes: 10 additions & 4 deletions python/plugins/processing/algs/qgis/DefineProjection.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

"""
***************************************************************************
SpatialIndex.py
DefineProjection.py
---------------------
Date : January 2016
Copyright : (C) 2016 by Alexander Bruy
Expand Down Expand Up @@ -53,7 +53,7 @@ def __init__(self):

def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterVectorLayer(self.INPUT,
self.tr('Input Layer'), types=[QgsProcessing.TypeVectorAnyGeometry]))
self.tr('Input Shapefile'), types=[QgsProcessing.TypeVectorAnyGeometry]))
self.addParameter(QgsProcessingParameterCrs(self.CRS, 'CRS'))
self.addOutput(QgsProcessingOutputVectorLayer(self.INPUT,
self.tr('Layer with projection')))
Expand All @@ -62,7 +62,13 @@ def name(self):
return 'definecurrentprojection'

def displayName(self):
return self.tr('Define layer projection')
return self.tr('Define Shapefile projection')

def tags(self):
return self.tr('layer,shp,prj,qpj,change,alter').split(',')

def shortDescription(self):
return self.tr('Changes a Shapefile\'s projection to a new CRS without reprojecting features')

def flags(self):
return super().flags() | QgsProcessingAlgorithm.FlagNoThreading
Expand Down Expand Up @@ -91,7 +97,7 @@ def processAlgorithm(self, parameters, context, feedback):
else:
os.remove(qpjFile)
else:
feedback.pushConsoleInfo(self.tr("Data source isn't a shapefile, skipping .prj/.qpj creation"))
feedback.pushConsoleInfo(self.tr("Data source isn't a Shapefile, skipping .prj/.qpj creation"))

layer.setCrs(crs)
layer.triggerRepaint()
Expand Down

0 comments on commit 692a140

Please sign in to comment.