forked from planetfederal/desktop-lessons
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds endcheck and prestep functions to join table lesson
- Loading branch information
1 parent
3bd88f5
commit b5542d0
Showing
5 changed files
with
47 additions
and
3 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
vector_layers_attributes/Join_table_to_vector_layer/04_open_layer_properties.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
vector_layers_attributes/Join_table_to_vector_layer/05_add_vector_join.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
vector_layers_attributes/Join_table_to_vector_layer/functions.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from lessons.utils import layerFromName | ||
|
||
# Functions | ||
|
||
# EndCheck Function | ||
|
||
def fieldExists(layername, string): | ||
""" | ||
Check if a layer has a field which name contains the specified string | ||
The layer should be of the vector type and be loaded into project. | ||
:param layername: Layer's name as visible in the layers panel | ||
:param string: string of text | ||
:return: Boolean | ||
""" | ||
|
||
layer = layerFromName(layername) | ||
if layer is None: | ||
return False | ||
|
||
for field in layer.pendingFields(): | ||
if string in field.name(): | ||
return True | ||
|
||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file removed
BIN
-7.79 KB
vector_layers_attributes/Join_table_to_vector_layer/open_joins_tab.png
Binary file not shown.