Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GeoSentinel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mario Chirinos Colunga
GeoSentinel
Commits
e35b8020
Commit
e35b8020
authored
May 17, 2018
by
Mario Chirinos Colunga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
example
parent
ff2eef3c
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
53 deletions
+25
-53
downloadTest.py
examples/downloadTest.py
+6
-4
APISentinel.py
geosentinel/APISentinel.py
+18
-28
APISentinel.pyc
geosentinel/APISentinel.pyc
+0
-0
__init__.py
geosentinel/__init__.py
+1
-21
__init__.pyc
geosentinel/__init__.pyc
+0
-0
No files found.
examples/downloadTest.py
View file @
e35b8020
#!/usr/bin/python
# -*- coding: utf-8 -*-
form
../
geosentinel
import
APISentienel
import
sys
sys
.
path
.
append
(
'../'
)
from
geosentinel
import
APISentinel
from
datetime
import
date
sentinel
=
APISentinel
.
APISentinel
(
'asalazarg'
,
'geo135asg'
)
#products = sentinel.getProducts("POLYGON((-89.99450683593753 21.279137394108716,-89.13757324218751 21.2996106049456,-89.30236816406251 20.68418377935238,-90.0494384765625 20.715015145512098,-89.99450683593753 21.279137394108716))", ('20151219', date(2015,12,29)), {"platformname":"Sentinel-2"})
polygon
=
"POLYGON((-89.79030210118333 21.122657323983717,-89.77308220413153 21.122657323983717,-89.77308220413153 21.140540053466538,-89.79030210118333 21.140540053466538,-89.79030210118333 21.122657323983717))"
products
=
sentinel
.
getProducts
(
polygon
,
(
'20150101'
,
'20180517'
),
{
"platformname"
:
"Sentinel-2"
,
"cloudcoverpercentage"
:
"[0 TO 0]"
})
print
len
(
products
)
#sentinel.downloadProducts(products,dir)
geosentinel/APISentinel.py
View file @
e35b8020
...
...
@@ -3,7 +3,8 @@
"""
Install:
$ pip install sentinelsat
$ sudo pip install sentinelsat
$ sudo apt-get install libgdal-dev
Example:
...
...
@@ -14,7 +15,7 @@ import os
from
sentinelsat.sentinel
import
SentinelAPI
from
datetime
import
date
from
collections
import
OrderedDict
from
osgeo
import
ogr
#
from osgeo import ogr
class
APISentinel
(
object
):
...
...
@@ -81,39 +82,28 @@ class APISentinel(object):
self
.
api
.
download_all
(
products
)
def
filterProducts
(
self
,
products_list
,
user_footprint
,
threshold
):
products_down
=
OrderedDict
()
products_down
=
products_list
.
copy
()
products_df
=
self
.
api
.
to_dataframe
(
products_list
)
#
def filterProducts(self, products_list, user_footprint, threshold):
#
products_down = OrderedDict()
#
products_down = products_list.copy()
#
products_df = self.api.to_dataframe(products_list)
polyfootprint
=
ogr
.
CreateGeometryFromWkt
(
user_footprint
)
areafootprint
=
polyfootprint
.
GetArea
()
#
polyfootprint = ogr.CreateGeometryFromWkt(user_footprint)
#
areafootprint = polyfootprint.GetArea()
for
i
in
range
(
len
(
products_df
)):
#
for i in range(len(products_df)):
inputpoly
=
ogr
.
CreateGeometryFromWkt
(
products_df
.
footprint
[
i
])
#
inputpoly = ogr.CreateGeometryFromWkt(products_df.footprint[i])
intersectionpoly
=
polyfootprint
.
Intersection
(
inputpoly
)
#
intersectionpoly = polyfootprint.Intersection(inputpoly)
intersectionpoly_area
=
intersectionpoly
.
GetArea
()
#
intersectionpoly_area = intersectionpoly.GetArea()
por_intersection
=
(
intersectionpoly_area
*
100
)
/
areafootprint
#
por_intersection = (intersectionpoly_area * 100) / areafootprint
if
(
por_intersection
<=
threshold
):
# Deleting element
del
products_down
[
products_df
.
uuid
[
i
]]
#
if (por_intersection <= threshold):
#
# Deleting element
#
del products_down[products_df.uuid[i]]
return
products_down
#
return products_down
sentinel
=
APISentinel
(
'asalazarg'
,
'geo135asg'
)
dir
=
"make1"
polygon
=
"POLYGON((-89.81053770202163 21.11585680707654,-89.75755340340068 21.11585680707654,-89.75755340340068 21.15331224168125,-89.81053770202163 21.15331224168125,-89.81053770202163 21.11585680707654))"
options
=
{
"platformname"
:
"Sentinel-2"
,
"cloudcoverpercentage"
:
"[0 TO 30]"
}
#, "footprint": "Intersects("+polygon+")"}
print
options
products
=
sentinel
.
getProducts
(
polygon
,
(
'20150801'
,
date
(
2018
,
05
,
15
)),
options
)
print
len
(
products
)
products
=
sentinel
.
filterProducts
(
products
,
polygon
,
95
)
print
len
(
products
)
sentinel
.
downloadProducts
(
products
,
dir
)
geosentinel/APISentinel.pyc
View file @
e35b8020
No preview for this file type
geosentinel/__init__.py
View file @
e35b8020
...
...
@@ -19,25 +19,5 @@
"""
Utilities for GeoSentinel.
Modules:
* "products" - Sentinel products
* "ui_utils" - Utilities for user interaction
* "exceptions" - Various exceptions
Sentinel products
******************
.. automodule:: geosentinel.products
User interface utilities
************************
.. automodule:: geosentinel.ui_utils
Exceptions
**********
.. automodule:: geosentinel.exceptions
"""
geosentinel/__init__.pyc
0 → 100644
View file @
e35b8020
File added
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment