-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from GispoCoding/42-add-a-way-to-create-a-new-…
…qgis-line-layer-which-can-be-used-as-a-gate-layer 42 add a way to create a new qgis line layer which can be used as a gate layer
- Loading branch information
Showing
2 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
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,17 @@ | ||
from __future__ import annotations | ||
|
||
from qgis.core import QgsField, QgsVectorLayer | ||
from qgis.PyQt.QtCore import QVariant | ||
|
||
|
||
def create_line_layer() -> QgsVectorLayer: | ||
layer = QgsVectorLayer("LineString?crs=EPSG:3067", "Line Layer", "memory") | ||
|
||
layer.startEditing() | ||
|
||
layer.addAttribute(QgsField("counts_left", QVariant.Bool)) | ||
layer.addAttribute(QgsField("counts_right", QVariant.Bool)) | ||
|
||
layer.commitChanges() | ||
|
||
return layer |
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