Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
get_nib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
A Nilsen
get_nib
Commits
a628c822
Commit
a628c822
authored
2 years ago
by
A Nilsen
Browse files
Options
Downloads
Patches
Plain Diff
Valgfri prosjekttype (of, sat og/eller ir)
parent
902b0d8d
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
get_nib.py
+32
-2
32 additions, 2 deletions
get_nib.py
with
32 additions
and
2 deletions
get_nib.py
+
32
−
2
View file @
a628c822
...
...
@@ -430,6 +430,10 @@ class getnib:
"""
If this should not be the default, remove comment # from next line
"""
# self.dlg.checkBox_resetNib.setChecked(False) # Unchecked
# As default: Set orthophoto-projects checkbox checked
"""
If this should not be the default, remove comment # from next line
"""
self
.
dlg
.
checkBox_resetNib
.
setChecked
(
True
)
# Unchecked
# As default: Set map canvas checkbox to checked
"""
If this should not be the default, comment # next line
"""
self
.
dlg
.
radioButton_ucmcbb
.
setChecked
(
True
)
# Checked
...
...
@@ -510,10 +514,22 @@ class getnib:
""""
Additional code
"""
selectedLayer
=
''
# Initialize
reset
=
False
of
=
False
sat
=
False
ir
=
False
if
self
.
dlg
.
checkBox_resetNib
.
isChecked
():
# Empty the Nib-prosjekt group
reset
=
True
if
self
.
dlg
.
checkBox_of_proj
.
isChecked
():
# Orthphoto-projects is checked
of
=
True
if
self
.
dlg
.
checkBox_sat_proj
.
isChecked
():
# Satellite-projects is checked
sat
=
True
if
self
.
dlg
.
checkBox_ir_proj
.
isChecked
():
# Infrared-projects is checked
ir
=
True
# If checked, use current map canvas as bounding box (= extent of)
if
self
.
dlg
.
radioButton_ucmcbb
.
isChecked
():
# Get the extent of current map canvas (coordinates in the project's crs)
...
...
@@ -553,7 +569,7 @@ class getnib:
else
:
# If no file or layer is selcted, throw an error mesage and end plugin
self
.
iface
.
messageBar
().
pushMessage
(
"
Error
"
,
"
No layer selected!
"
,
level
=
Qgis
.
Critical
,
duration
=
3
)
return
# Return from (end) plugin
elif
self
.
dlg
.
radioButton_file
.
isChecked
():
# File-option checked
fname
=
self
.
dlg
.
lineEdit_file
.
text
()
# Get the text (path and filename)
if
fname
!=
""
:
...
...
@@ -642,7 +658,21 @@ class getnib:
# Load Norge i bilder-project based on the bounding box (geojson-format x1,y1;x2,y2;x3,y3;...)
# https://norgeibilder.no/dok/webtjenester.pdf
# 1 = Ortofoto 10, 2 = Ortofoto 20, 3 = Ortofoto 50, 4 = Ortofoto N50, 5 = Ortofoto Skog, 6 = Satellittbilde, 7 = Infrarødt, 8 = Rektifiserte flybilder, 9 = Ortofoto
para
=
parse
.
quote
(
'
{Filter:
"
ortofototype in (1,2,3,4,5,6,7,8,9)
"
,Coordinates:
"'
+
coords
+
'"
,InputWKID:
'
+
str
(
crs_proj_int
)
+
'
,StopOnCover:false}
'
)
if
of
and
not
sat
and
not
ir
:
param
=
'
{Filter:
"
ortofototype in (1,2,3,4,5,8,9)
"
,Coordinates:
"'
+
coords
+
'"
,InputWKID:
'
+
str
(
crs_proj_int
)
+
'
,StopOnCover:false}
'
if
of
and
sat
and
not
ir
:
param
=
'
{Filter:
"
ortofototype in (1,2,3,4,5,6,8,9)
"
,Coordinates:
"'
+
coords
+
'"
,InputWKID:
'
+
str
(
crs_proj_int
)
+
'
,StopOnCover:false}
'
if
of
and
sat
and
ir
:
param
=
'
{Filter:
"
ortofototype in (1,2,3,4,5,6,7,8,9)
"
,Coordinates:
"'
+
coords
+
'"
,InputWKID:
'
+
str
(
crs_proj_int
)
+
'
,StopOnCover:false}
'
if
sat
and
not
of
and
not
ir
:
param
=
'
{Filter:
"
ortofototype in (6)
"
,Coordinates:
"'
+
coords
+
'"
,InputWKID:
'
+
str
(
crs_proj_int
)
+
'
,StopOnCover:false}
'
if
sat
and
ir
and
not
of
:
param
=
'
{Filter:
"
ortofototype in (6,7)
"
,Coordinates:
"'
+
coords
+
'"
,InputWKID:
'
+
str
(
crs_proj_int
)
+
'
,StopOnCover:false}
'
if
ir
and
not
sat
and
not
of
:
param
=
'
{Filter:
"
ortofototype in (7)
"
,Coordinates:
"'
+
coords
+
'"
,InputWKID:
'
+
str
(
crs_proj_int
)
+
'
,StopOnCover:false}
'
# para=parse.quote('{Filter:"ortofototype in (1,2,3,4,5,6,7,8,9)",Coordinates:"'+coords+'",InputWKID:'+str(crs_proj_int)+',StopOnCover:false}')
para
=
parse
.
quote
(
param
)
js
=
requests
.
get
(
'
https://tjenester.norgeibilder.no/rest/projectMetadata.ashx?request=
'
+
para
).
json
()
#list with current of-project on json-format
nib_liste
=
js
[
'
ProjectList
'
]
# Debugging
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment