Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Plio
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
aflab
astrogeology
Plio
Commits
a3250e03
Commit
a3250e03
authored
6 years ago
by
jay
Browse files
Options
Downloads
Patches
Plain Diff
REmoved missed spatial func
parent
8f553d06
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plio/utils/generate_vrt.py
+0
-48
0 additions, 48 deletions
plio/utils/generate_vrt.py
with
0 additions
and
48 deletions
plio/utils/generate_vrt.py
deleted
100644 → 0
+
0
−
48
View file @
8f553d06
import
gdal
import
os
import
jinja2
import
numpy
as
np
from
plio.spatial.footprint
import
generate_gcps
def
warped_vrt
(
camera
,
raster_size
,
fpath
,
outpath
=
None
,
no_data_value
=
0
):
gcps
=
generate_gcps
(
camera
)
xsize
,
ysize
=
raster_size
if
outpath
is
None
:
outpath
=
os
.
path
.
dirname
(
fpath
)
outname
=
os
.
path
.
splitext
(
os
.
path
.
basename
(
fpath
))[
0
]
+
'
.vrt
'
outname
=
os
.
path
.
join
(
outpath
,
outname
)
xsize
,
ysize
=
raster_size
vrt
=
r
'''
<VRTDataset rasterXSize=
"
{{ xsize }}
"
rasterYSize=
"
{{ ysize }}
"
>
<Metadata/>
<GCPList Projection=
"
{{ proj }}
"
>
{% for gcp in gcps -%}
{{gcp}}
{% endfor -%}
</GCPList>
<VRTRasterBand dataType=
"
Float32
"
band=
"
1
"
>
<NoDataValue>{{ no_data_value }}</NoDataValue>
<Metadata/>
<ColorInterp>Gray</ColorInterp>
<SimpleSource>
<SourceFilename relativeToVRT=
"
0
"
>{{ fpath }}</SourceFilename>
<SourceBand>1</SourceBand>
<SourceProperties rasterXSize=
"
{{ xsize }}
"
rasterYSize=
"
{{ ysize }}
"
DataType=
"
Float32
"
BlockXSize=
"
512
"
BlockYSize=
"
512
"
/>
<SrcRect xOff=
"
0
"
yOff=
"
0
"
xSize=
"
{{ xsize }}
"
ySize=
"
{{ ysize }}
"
/>
<DstRect xOff=
"
0
"
yOff=
"
0
"
xSize=
"
{{ xsize }}
"
ySize=
"
{{ ysize }}
"
/>
</SimpleSource>
</VRTRasterBand>
</VRTDataset>
'''
context
=
{
'
xsize
'
:
xsize
,
'
ysize
'
:
ysize
,
'
gcps
'
:
gcps
,
'
proj
'
:
'
+proj=longlat +a=3396190 +b=3376200 +no_defs
'
,
'
fpath
'
:
fpath
,
'
no_data_value
'
:
no_data_value
}
template
=
jinja2
.
Template
(
vrt
)
tmp
=
template
.
render
(
context
)
warp_options
=
gdal
.
WarpOptions
(
format
=
'
VRT
'
,
dstNodata
=
0
)
gdal
.
Warp
(
outname
,
tmp
,
options
=
warp_options
)
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