Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GeoInt_SIDT
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mario Chirinos Colunga
GeoInt_SIDT
Commits
9e8f9db8
Commit
9e8f9db8
authored
Jan 24, 2019
by
Emmanuel René Huchim Puc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge headers deleted
parent
ef6c8b1a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
30 deletions
+18
-30
urls.py
catalog/urls.py
+0
-6
views.py
catalog/views.py
+18
-24
No files found.
catalog/urls.py
View file @
9e8f9db8
...
@@ -11,12 +11,6 @@ urlpatterns = [
...
@@ -11,12 +11,6 @@ urlpatterns = [
url
(
r'^imgrequest/$'
,
views
.
requestToImage
,
name
=
'img-rqst'
),
url
(
r'^imgrequest/$'
,
views
.
requestToImage
,
name
=
'img-rqst'
),
url
(
r'^cartrequest/$'
,
views
.
saveInCart
,
name
=
'cart-rqst'
),
url
(
r'^cartrequest/$'
,
views
.
saveInCart
,
name
=
'cart-rqst'
),
url
(
r'^fromcartrqst/$'
,
views
.
getFromCart
,
name
=
'from-cart-rqst'
),
url
(
r'^fromcartrqst/$'
,
views
.
getFromCart
,
name
=
'from-cart-rqst'
),
<<<<<<<
HEAD
# url(r'^scl/$', views.L2ASCL_data, name='L2ASCL-data'),
=======
url
(
r'^purchcartrqst/$'
,
views
.
purchaseProduct
,
name
=
'purch-prod-rqst'
),
url
(
r'^purchcartrqst/$'
,
views
.
purchaseProduct
,
name
=
'purch-prod-rqst'
),
url
(
r'^scl/$'
,
views
.
L2ASCL_data
,
name
=
'L2ASCL-data'
)
url
(
r'^scl/$'
,
views
.
L2ASCL_data
,
name
=
'L2ASCL-data'
)
>>>>>>>
ad233d589b10f9ad3e86a5f5e5201c7abf763f77
]
]
catalog/views.py
View file @
9e8f9db8
...
@@ -75,7 +75,7 @@ def productList(request):
...
@@ -75,7 +75,7 @@ def productList(request):
# if cloud_percentage.strip():
# if cloud_percentage.strip():
# params['cloudcoverpercentage'] = cloud_percentage
# params['cloudcoverpercentage'] = cloud_percentage
params
[
'cloudcoverpercentage'
]
=
cloud_percentage
params
[
'cloudcoverpercentage'
]
=
cloud_percentage
## getting the bounding box of the polygon
## getting the bounding box of the polygon
pol_bbox
=
polygonToBox
.
getWKTPolygonBoundingBox
(
area
,
True
)
pol_bbox
=
polygonToBox
.
getWKTPolygonBoundingBox
(
area
,
True
)
...
@@ -90,7 +90,7 @@ def productList(request):
...
@@ -90,7 +90,7 @@ def productList(request):
for
p
in
products
:
for
p
in
products
:
# img_link = products[p]['link_icon']
# img_link = products[p]['link_icon']
# img_link = img_link[:img_link.find("/")+2] + "emmhp:geoemm29@" + img_link[img_link.find("/")+2:]
# img_link = img_link[:img_link.find("/")+2] + "emmhp:geoemm29@" + img_link[img_link.find("/")+2:]
catalog
.
append
({
catalog
.
append
({
'process'
:
process
,
'process'
:
process
,
'start_date'
:
init_date
,
'start_date'
:
init_date
,
...
@@ -111,7 +111,7 @@ class SearchSubmitView(View):
...
@@ -111,7 +111,7 @@ class SearchSubmitView(View):
def
strip_accents
(
self
,
s
):
def
strip_accents
(
self
,
s
):
return
''
.
join
((
c
for
c
in
unicodedata
.
normalize
(
'NFD'
,
s
)
if
unicodedata
.
category
(
c
)
!=
'Mn'
))
return
''
.
join
((
c
for
c
in
unicodedata
.
normalize
(
'NFD'
,
s
)
if
unicodedata
.
category
(
c
)
!=
'Mn'
))
def
post
(
self
,
request
):
def
post
(
self
,
request
):
template
=
loader
.
get_template
(
self
.
template
)
template
=
loader
.
get_template
(
self
.
template
)
searchValue
=
request
.
POST
.
get
(
'value'
,
''
)
searchValue
=
request
.
POST
.
get
(
'value'
,
''
)
...
@@ -178,7 +178,7 @@ def saveInCart(request):
...
@@ -178,7 +178,7 @@ def saveInCart(request):
info
=
json
.
dumps
(
p_info
,
indent
=
3
,
sort_keys
=
True
,
ensure_ascii
=
True
),
info
=
json
.
dumps
(
p_info
,
indent
=
3
,
sort_keys
=
True
,
ensure_ascii
=
True
),
purchased
=
False
purchased
=
False
)
)
cartProd
.
save
()
cartProd
.
save
()
...
@@ -202,7 +202,7 @@ def getFromCart(request):
...
@@ -202,7 +202,7 @@ def getFromCart(request):
})
})
return
JsonResponse
({
'product_list'
:
prod_list
})
return
JsonResponse
({
'product_list'
:
prod_list
})
<<<<<<<
HEAD
##-------------------------------------------------------------------------------
##-------------------------------------------------------------------------------
#def L2ASCL_data(request):
#def L2ASCL_data(request):
# with open("/home/mario/NAS_MarioCh/mario_repsat_test/T15QZD_sclData.json") as f:
# with open("/home/mario/NAS_MarioCh/mario_repsat_test/T15QZD_sclData.json") as f:
...
@@ -218,7 +218,8 @@ def getFromCart(request):
...
@@ -218,7 +218,8 @@ def getFromCart(request):
# labels |= set(json_data[d].keys())
# labels |= set(json_data[d].keys())
# labels.remove('date')
# labels.remove('date')
# labelNames = ["No Data", "Saturated", "Shadows", "Cloud Shadows", "Vegetation", "Not-Vegetated", "Whater", "Unclassified", "Cloud Medium Probablilty", "Cloud Hight Probablilty", "Thin Cirrus", "Snow"]
# labelNames = ["No Data", "Saturated", "Shadows", "Cloud Shadows", "Vegetation",
# "Not-Vegetated", "Whater", "Unclassified", "Cloud Medium Probablilty", "Cloud Hight Probablilty", "Thin Cirrus", "Snow"]
# colors = ["Black", "Red", "DarkGray", "Brown", "Green", "Yellow", "Blue", "Grey", "LightGray", "White", "Aqua", "Pink"]
# colors = ["Black", "Red", "DarkGray", "Brown", "Green", "Yellow", "Blue", "Grey", "LightGray", "White", "Aqua", "Pink"]
# for l in labels:
# for l in labels:
# item = dict()
# item = dict()
...
@@ -237,8 +238,7 @@ def getFromCart(request):
...
@@ -237,8 +238,7 @@ def getFromCart(request):
# return render(request, 'L2ASCL_data.html', {"graphData":json.dumps(graphData).encode("utf-8")})
# return render(request, 'L2ASCL_data.html', {"graphData":json.dumps(graphData).encode("utf-8")})
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
def
wsReportImages
(
request
):
def
wsReportImages
(
request
):
print
(
request
.
GET
)
print
(
request
.
GET
)
=======
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
def
purchaseProduct
(
request
):
def
purchaseProduct
(
request
):
...
@@ -263,15 +263,10 @@ def purchaseProduct(request):
...
@@ -263,15 +263,10 @@ def purchaseProduct(request):
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
def
L2ASCL_data
(
request
):
def
L2ASCL_data
(
request
):
with
open
(
"/home/mchc/data.json"
)
as
f
:
with
open
(
"/home/mchc/data.json"
)
as
f
:
json_data
=
json
.
load
(
f
)
json_data
=
json
.
load
(
f
)
print
(
json_data
)
print
(
json_data
)
return
render
(
request
,
'L2ASCL_data.html'
,
{
"labels"
:
","
.
join
([
k
for
k
in
json_data
]),
"vegetation"
:[
v
[
"4"
]
for
k
,
v
in
json_data
.
items
()]
})
return
render
(
request
,
'L2ASCL_data.html'
,
{
"labels"
:
","
.
join
([
k
for
k
in
json_data
]),
"vegetation"
:[
v
[
"4"
]
for
k
,
v
in
json_data
.
items
()]
})
>>>>>>>
ad233d589b10f9ad3e86a5f5e5201c7abf763f77
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# def purchaseProduct(request):
# def purchaseProduct(request):
# """
# """
...
@@ -288,7 +283,7 @@ def L2ASCL_data(request):
...
@@ -288,7 +283,7 @@ def L2ASCL_data(request):
# user = User.objects.get(id=request.user.id)
# user = User.objects.get(id=request.user.id)
# prod_purchased = json.loads(request.POST['product_list'])
# prod_purchased = json.loads(request.POST['product_list'])
# # prod_purchased = ['S2B_MSIL1C_20171226T162659_N0206_R040_T16QBJ_20171226T212212', 'S2B_MSIL1C_20180326T161909_N0206_R040_T15QZD_20180326T195757']
# # prod_purchased = ['S2B_MSIL1C_20171226T162659_N0206_R040_T16QBJ_20171226T212212', 'S2B_MSIL1C_20180326T161909_N0206_R040_T15QZD_20180326T195757']
# for p in prod_purchased:
# for p in prod_purchased:
# p_uuid = p['uuid']
# p_uuid = p['uuid']
# p_identifier = p['identifier']
# p_identifier = p['identifier']
...
@@ -297,16 +292,16 @@ def L2ASCL_data(request):
...
@@ -297,16 +292,16 @@ def L2ASCL_data(request):
# if not PRODUCT_EXISTS:
# if not PRODUCT_EXISTS:
# products_to_download['uuid'].append(p_uuid)
# products_to_download['uuid'].append(p_uuid)
# products_to_download['id'].append(p_identifier)
# products_to_download['id'].append(p_identifier)
# # print json.dumps(p, indent=3, sort_keys=True)
# # print json.dumps(p, indent=3, sort_keys=True)
# ## Saves data to DB using populate_products_l1c command ##
# ## Saves data to DB using populate_products_l1c command ##
# management.call_command('populate_products_l1c', file_path=prod_dir, products_list=products_to_download['id'])
# management.call_command('populate_products_l1c', file_path=prod_dir, products_list=products_to_download['id'])
# ## Register of user purchase ##
# ## Register of user purchase ##
# purch = Purchase(user=user)
# purch = Purchase(user=user)
# purch.save()
# purch.save()
# for p_uuid in products_to_download['uuid']:
# for p_uuid in products_to_download['uuid']:
# prod_l1c = Product_l1c.objects.get(uuid=p_uuid)
# prod_l1c = Product_l1c.objects.get(uuid=p_uuid)
# purch.prod_list.add(prod_l1c)
# purch.prod_list.add(prod_l1c)
...
@@ -317,7 +312,7 @@ def L2ASCL_data(request):
...
@@ -317,7 +312,7 @@ def L2ASCL_data(request):
# ### TODO: Download products somewhere .. ###
# ### TODO: Download products somewhere .. ###
# # sentinel.downloadProducts(products, prod_dir)
# # sentinel.downloadProducts(products, prod_dir)
# ### After that the code below is executed ###
# ### After that the code below is executed ###
# # purch = Purchase(user=user)
# # purch = Purchase(user=user)
...
@@ -331,5 +326,4 @@ def L2ASCL_data(request):
...
@@ -331,5 +326,4 @@ def L2ASCL_data(request):
# # purch.prod_list.add(prod_l1c)
# # purch.prod_list.add(prod_l1c)
# return HttpResponse(status=204)
# return HttpResponse(status=204)
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