Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
api
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
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
DUKEMS
api
Commits
d48e2572
Commit
d48e2572
authored
3 years ago
by
Jonathan Cooper
Browse files
Options
Downloads
Patches
Plain Diff
removed redundant featureinfo endpoint and dependencies
parent
d625b7c1
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!3
Removed redundant featureinfo endpoint and dependencies
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/api.py
+1
-10
1 addition, 10 deletions
src/api.py
src/featureinfo.py
+0
-26
0 additions, 26 deletions
src/featureinfo.py
src/requirements.txt
+0
-1
0 additions, 1 deletion
src/requirements.txt
with
1 addition
and
37 deletions
src/api.py
+
1
−
10
View file @
d48e2572
from
flask
import
Flask
,
jsonify
,
send_from_directory
,
after_this_request
from
markupsafe
import
escape
import
timeseries
,
legend
,
featureinfo
,
plantinfo
,
download
import
timeseries
,
legend
,
plantinfo
,
download
import
logging
as
log
import
os
...
...
@@ -19,15 +19,6 @@ def get_legend(pollutant):
log
.
debug
(
f
'
/api/legend/
{
pollutant
}
'
)
return
legend
.
getlegend
(
escape
(
pollutant
))
# eg http://localhost:8082/api/featureinfo/NAEIPointsSources_2018/1/2
@app.route
(
'
/api/featureinfo/<string:id>/<string:x>/<string:y>
'
)
def
get_info
(
id
,
x
,
y
):
log
.
debug
(
f
'
/api/featureinfo/
{
id
}
/
{
x
}
/
{
y
}
'
)
xf
=
float
(
escape
(
x
))
yf
=
float
(
escape
(
y
))
# return jsonify(timeseries.getdata(xf, yf))
return
featureinfo
.
get
(
id
,
xf
,
yf
)
# eg http://localhost:8082/api/plantinfo/NAEIPointsSources_2018/3948
@app.route
(
'
/api/plantinfo/<string:datasetid>/<string:plantid>
'
)
def
get_plantinfo
(
datasetid
,
plantid
):
...
...
This diff is collapsed.
Click to expand it.
src/featureinfo.py
deleted
100644 → 0
+
0
−
26
View file @
d625b7c1
import
geopandas
as
gpd
from
shapely.geometry
import
Point
import
logging
as
log
import
json
# Get the point features for the dataset named in 'id' that are within 3000m of the incomming point
def
get
(
id
,
xf
,
yf
):
path
=
f
'
/pointdata/
{
id
}
.shp
'
radius
=
3000
try
:
buf
=
Point
(
xf
,
yf
).
buffer
(
radius
)
gdf
=
gpd
.
read_file
(
path
,
mask
=
buf
)
points
=
[]
for
index
,
row
in
gdf
.
iterrows
():
coords
=
[(
coords
)
for
coords
in
list
(
row
[
'
geometry
'
].
coords
)][
0
]
toAppend
=
{
'
coord
'
:
{
'
x
'
:
coords
[
0
],
'
y
'
:
coords
[
1
]},
'
properties
'
:
{}
}
for
col
in
gdf
.
columns
:
if
(
col
!=
'
geometry
'
):
toAppend
[
'
properties
'
][
col
]
=
row
[
col
]
points
.
append
(
toAppend
)
return
{
'
features
'
:
points
}
except
Exception
as
ex
:
log
.
debug
(
f
'
Unknown error:
{
ex
}
'
)
This diff is collapsed.
Click to expand it.
src/requirements.txt
+
0
−
1
View file @
d48e2572
...
...
@@ -4,5 +4,4 @@ pandas==1.3.0
setuptools==57.4.0
netCDF4==1.5.7
xarray==0.18.2
geopandas==0.9.0
gevent==20.9.0
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