Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
85095af
demo.py was spitted into demo.py, app.py, app_main_page.py, processes…
idanmiara Aug 2, 2020
521f74c
app.wsgi - set root and add it to the path (useful for using with mod…
idanmiara Aug 12, 2020
d6c0d0f
templates/base.html, templates/home.html - add alt description to ima…
idanmiara Aug 16, 2020
91e2fa9
app_main_page.py - remove old commented code; fix comment
idanmiara Aug 16, 2020
0474409
conf.py - use constant strings instead of strings duplications
idanmiara Aug 16, 2020
deb772e
buffer.py - rename vars to comply with PEP8
idanmiara Aug 17, 2020
572e159
common.py - reformat and remove some unnecessary code
idanmiara Aug 17, 2020
c756721
say_hello.py - use process_id var
idanmiara Aug 17, 2020
9087713
test_execute.py - use const strings instead of duplicated strings
idanmiara Aug 17, 2020
4b0b108
common.py - fix previous commit
idanmiara Aug 17, 2020
29b60fd
tests/common.py - use cache with get_schema tests/test_execute.py - s…
idanmiara Aug 19, 2020
469ac82
app.py - project_root added to the path to allow loading from Apache/…
idanmiara Aug 23, 2020
6bff219
pywps.cfg - added allowedinputpaths; increase maxsingleinputsize, max…
idanmiara Aug 2, 2020
c2a197a
updated process_defaults.yaml
idanmiara Aug 5, 2020
7cd19c1
src_ovr -> ovr_idx: overview indexes redefined
idanmiara Aug 9, 2020
8543513
viewshed.py - r_ovr -> ovr; ovr passed to viewshed_calc
idanmiara Aug 12, 2020
7d1d1dc
update configs
idanmiara Aug 23, 2020
5609020
processes/process_defaults.py fixed
idanmiara Aug 23, 2020
f1b0fcb
store 3rd party packages patches that have not been accepted to the o…
idanmiara Aug 26, 2020
d647e47
requirements.txt - add numpy
idanmiara Aug 26, 2020
b22e348
config/pywps.cfg - update allowedinputpaths
idanmiara Aug 27, 2020
e7056d1
remove patches
idanmiara Aug 27, 2020
5437ef2
v0.43.7
idanmiara Aug 31, 2020
7e55ac8
v0.44.0
idanmiara Sep 6, 2020
fdf8b3f
app_debug.py added
idanmiara Sep 7, 2020
e3e586d
installer/install.bat, installer/make_install.bat added
idanmiara Sep 7, 2020
a13a852
v0.45.0
idanmiara Sep 16, 2020
ecd4604
version infomation updated
idanmiara Sep 16, 2020
ef426ea
installer and __data__ updated
idanmiara Sep 16, 2020
4cd2d3f
added radio support
idanmiara Nov 25, 2020
8ff4393
misc fixes
idanmiara Dec 2, 2020
ea2d857
add los calc
idanmiara Dec 10, 2020
aafc3ba
.
idanmiara Dec 15, 2020
3182d72
requirements.txt update with pywps-json and numpy<=1.19.3
idanmiara Dec 15, 2020
3b64d5b
udpate installers
idanmiara Dec 15, 2020
032d9db
demo.py, app_debug.py - update debug modules
idanmiara Dec 16, 2020
461dd3f
los.py - fill_mode -> xy_fill, ot_fill
idanmiara Dec 16, 2020
938b5cc
los.py - mock added
idanmiara Dec 17, 2020
7aa0754
requirements-opt.txt - add gdal
idanmiara Dec 17, 2020
c835a0b
update installers
idanmiara Dec 17, 2020
49d9ccb
json output added
idanmiara Dec 20, 2020
523b0a6
viewshed.py, los.py - move common inputs/outputs into io_generator.py
idanmiara Dec 20, 2020
87dd05f
postman/talos_wps.postman_collection.json - add radio tests
idanmiara Dec 21, 2020
2b3e013
processes/trans.py added
idanmiara Dec 23, 2020
75df014
io_generator.py - remove limited max_occurs
idanmiara Dec 23, 2020
4984dee
talos_wps.postman_collection.json - added trans example
idanmiara Dec 23, 2020
f8c53f4
requirements.txt - update minimum versions
idanmiara Dec 23, 2020
e354e74
install-2-talos_wps.bat updated
idanmiara Dec 28, 2020
73d3305
rasval, trans processes improved; xyz and sandbox processes added
idanmiara Jan 4, 2021
dd0fca8
los.py fix
idanmiara Jan 7, 2021
f9b144e
upgrade to gdalos 0.50
idanmiara Jan 20, 2021
77e879a
update requirements: gdalos>=0.50.0, talosgis>=2.7.6.3
idanmiara Jan 26, 2021
444d054
viewshed.py - add support for out_res
idanmiara Jan 26, 2021
92b565f
process_defaults.yaml, pywps.cfg - update
idanmiara Jan 26, 2021
414dfb7
VERSION.txt - 2.1.0 (based on pywps-flask 4.2.1)
idanmiara Jan 26, 2021
1c2842f
v2.1.1 - update xyz.py
idanmiara Jan 27, 2021
1227c2d
requirements.txt update
idanmiara Jan 27, 2021
76a485b
template config files - config/* files can be auto generate now by ru…
idanmiara Jan 31, 2021
a8ba500
requirements.txt update
idanmiara Feb 3, 2021
55ad36f
VERSION.txt 2.2.1
idanmiara Feb 3, 2021
ff1e267
gdalinfo.py process added
idanmiara Feb 4, 2021
e54cc2f
rasval.py fix import
idanmiara Feb 4, 2021
566a34b
v2.2.2
idanmiara Feb 4, 2021
f62c325
info.py - add gdal driver list
idanmiara Feb 4, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ pywps_demo.egg-info/

# docs build artifacts
_build/

temp/
3 changes: 3 additions & 0 deletions LICENCE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
MIT License

Copyright (C) 2015 PyWPS Development Team, represented by Jachym Cepicky
Copyright (C) 2020 Idan Miara, Ben Avrahami

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
Expand Down
15 changes: 15 additions & 0 deletions README_TALOS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
:Name: talos-wps
:Authors: Idan Miara, Ben Avrahami

.. |license| image:: https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square
:target: https://github.com/talos-gis/gdalos/raw/master/LICENSE

.. |GDAL| image:: https://github.com/OSGeo/gdal/raw/master/gdal/data/gdalicon.png?style=flat-square
:target: https://github.com/OSGeo/gdal

|license|

pywps service for some of our neat gdal processes

* gdaldem - crops to an extent and/or to a cutline polygon[s] and/or makes a color relief
* viewshed - runs gdal.ViewshedGenerate
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.2.1
2.2.2
41 changes: 41 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env python3

# Copyright (c) 2016 PyWPS Project Steering Committee
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

import flask

# we need to set the root before we import the main_page as there are relative paths to this root (i.e. config files)
import sys
import os
project_root = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, project_root)
os.chdir(project_root)

from app_main_page import main_page

app = flask.Flask(__name__)
app.register_blueprint(main_page)

application = app # application is the default name for mod_wsgi

if __name__ == "__main__":
app.run()
17 changes: 17 additions & 0 deletions app_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import pywps.configuration as config
from app_set_server import set_server
from set_root import set_root

set_root()

config_path = 'config/'
cfgfiles = [config_path + 'pywps.cfg']
config.load_configuration(cfgfiles)

# these defaults will be overwritten with the url from by the server\url from the config file
server_hostname = 'http://localhost'
server_port = 5000
server_base_url = '{}:{}'.format(server_hostname, server_port)
server_wps_url = server_base_url + '/wps'

server_hostname, server_port, server_base_url, server_wps_url, _ = set_server(config.get_config_value("server", "url"))
47 changes: 47 additions & 0 deletions app_debug.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env python3

# Copyright (c) 2016 PyWPS Project Steering Committee
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

import flask

# we need to set the root before we import the main_page as there are relative paths to this root (i.e. config files)
import sys
import os


my_modules = [
r'D:\dev\gis\gdal\gdal\swig\python\gdal-utils',
r'D:\dev\gis\pywps',
r'D:\dev\gis\gdalos\src',
r'D:\dev\gis\TaLoS\1\p\talos\src',
]
for m in my_modules:
print(f'adding {m} to path')
sys.path.insert(0, m)

project_root = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, project_root)
os.chdir(project_root)

if __name__ == "__main__":
from demo import main
main()
67 changes: 67 additions & 0 deletions app_main_page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import os
import sys
import flask
import pywps
import processes
import app_config

# This is, how you start PyWPS instance
service = pywps.Service(processes=processes.processes)
# config is read in app_config so we don't need to pass it to Service as well
# service = pywps.Service(processes=processes.processes, cfgfiles=cfgfiles)

main_page = flask.Blueprint('main_page', __name__, template_folder='templates')


@main_page.route('/test')
def test():
return 'hello test!'


@main_page.route("/sys_path")
def sys_path():
return str(sys.path)


# returns 'hello to the WPS server root'
@main_page.route('/wps', methods=['GET', 'POST'])
def wps():
return service


@main_page.route("/")
def hello():
request_url = flask.request.url
return flask.render_template('home.html', request_url=request_url,
server_url=app_config.server_wps_url,
process_descriptor=processes.process_descriptor)


def flask_response(targetfile):
if os.path.isfile(targetfile):
with open(targetfile, mode='rb') as f:
file_bytes = f.read()
file_ext = os.path.splitext(targetfile)[1]
mime_type = 'text/xml' if 'xml' in file_ext else None
return flask.Response(file_bytes, content_type=mime_type)
else:
flask.abort(404)


@main_page.route('/outputs/' + '<path:filename>')
def outputfile(filename):
targetfile = os.path.join('outputs', filename)
return flask_response(targetfile)


@main_page.route('/data/' + '<path:filename>')
def datafile(filename):
targetfile = os.path.join('static', 'data', filename)
return flask_response(targetfile)


# not sure how the static route works. static route doesn't reach this function.
@main_page.route('/static/' + '<path:filename>')
def staticfile(filename):
targetfile = os.path.join('static', filename)
return flask_response(targetfile)
39 changes: 39 additions & 0 deletions app_set_server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import re
from exceptions import BadUserInputError


def set_server(new_server_wps_url: str):
pattern = r'((?:.*://)?(.*?)(?:(?::)(\d+))?(?:/.*?)?)$'
m = re.match(pattern, new_server_wps_url)
if not m:
raise BadUserInputError('cannot parse server url: {}'.format(new_server_wps_url))
# print(m.groups())
server_wps_url = m.group(1)
if server_wps_url.endswith('/'):
server_wps_url = server_wps_url.rstrip('/')
server_base_url = server_wps_url
if server_base_url.endswith('/wps'):
server_base_url = server_wps_url[:-4]
else:
server_wps_url = server_base_url + '/wps'
server_hostname = m.group(2)
server_port = m.group(3)
if server_port:
server_port = int(server_port)
else:
server_port = 80
return server_hostname, server_port, server_base_url, server_wps_url, new_server_wps_url


if __name__ == '__main__':
print(set_server('http://localhost:5000/abc/wps'))
print(set_server('http://localhost:5000/wps'))
print(set_server('http://localhost:5000/'))
print(set_server('http://localhost:5000'))
print(set_server('http://localhost/abc/wps'))
print(set_server('http://localhost/wps'))
print(set_server('http://localhost/'))
print(set_server('localhost'))
print(set_server('localhost:5000'))
print(set_server('localhost:5000/'))
print(set_server('localhost:5000/wps'))
Empty file added backend/__init__.py
Empty file.
4 changes: 4 additions & 0 deletions backend/formats.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from pywps import FORMATS, Format

czml_format = Format('application/czml+json', extension='.czml')
wkt_format = Format('application/wkt', extension='.wkt')
25 changes: 25 additions & 0 deletions config/instances/testing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
url: 'http://localhost:5000/wps'
allowedinputpaths:
- './static/'
- 'd:\Maps'
- 'd:\MRR'
default_mimetype: 'text/xml'
#default_mimetype: 'application/json'
#json_indent: -1
json_indent: 2

#root: './static/data/maps'
root: 'd:\Maps'

dtm_color_palette: './static/data/color_files/color_file_1.txt'

dtm_geo: './static/data/maps/srtm1_x35_y32.tif'
#dtm_geo: '@xlink:href=file:./static/data/maps/srtm1_x35_y32.tif'

dtm_utm: 'd:\maps\srtm3\utm\*.tif'
#dtm_utm: './static/data/maps/srtm1_w84u36.tif'

radio_refractivity: 333.0
radio_conductivity: 3.0
radio_permittivity: 33.0
radio_humidity: 33.0
48 changes: 48 additions & 0 deletions config/templates/process_defaults.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
say_hello:
name: "default-config"

ls:
dir: '{{ root }}'
pattern: '*.tif'

ras_val:
r: '{{ dtm_geo }}'

crop_color:
r: '{{ dtm_geo }}'
of: 'czml'
# color_palette: '{{ dtm_color_palette }}'

viewshed:
r: '{{ dtm_utm }}'
of: 'czml'
in_crs: '0'
out_crs: '0'
backend: 'talos'

refractivity: {{ radio_refractivity }}
conductivity: {{ radio_conductivity }}
permittivity: {{ radio_permittivity }}
humidity: {{ radio_humidity }}

fill_center: False
profile_extension: True

tester:
r: '{{ dtm_geo }}'
name: 'Tester'

los:
of: 'json'
r: '{{ dtm_utm }}'
in_crs: '0'
out_crs: '0'
backend: 'radio'

refractivity: {{ radio_refractivity }}
conductivity: {{ radio_conductivity }}
permittivity: {{ radio_permittivity }}
humidity: {{ radio_humidity }}

fill_center: False
profile_extension: True
23 changes: 13 additions & 10 deletions pywps.cfg → config/templates/pywps.cfg
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[metadata:main]
identification_title=PyWPS Demo server
identification_abstract=PyWPS testing and development server. Do NOT use this server in production environment. You shall setup PyWPS as WSGI application for production. Please refer documentation for further detials.
identification_keywords=WPS,GRASS,PyWPS, Demo, Dev
identification_title=TaLoS WPS server
identification_abstract=TaLoS WPS server server.
identification_keywords=WPS,GRASS,PyWPS,GDAL,Dev
identification_keywords_type=theme
identification_fees=None
identification_accessconstraints=None
provider_name=PyWPS Developement team
provider_url=http://pywps.org/'
contact_name=Your Name
provider_name=TaLoS GIS Development team
provider_url=https://github.com/talos-gis/pywps-flask
contact_name=Idan Miara
contact_position=Developer
contact_address=My Street
contact_city=My City
Expand All @@ -17,22 +17,25 @@ contact_country=World, Internet
contact_phone=+00 00 11 22 33
contact_fax=+00 99 88 77 66
contact_email=info@yourdomain.org
contact_url=http://pywps.org
contact_url=https://github.com/talos-gis
contact_hours=8:00-20:00UTC
contact_instructions=Knock on the door
contact_role=pointOfContact

[server]
maxsingleinputsize=1mb
maxrequestsize=3mb
url=http://localhost:5000/wps
outputurl=http://localhost:5000/outputs/
url={{ url }}
outputurl=outputs
outputpath=outputs
workdir=workdir
wd_inp_subdir=inputs
wd_out_subdir=outputs
maxprocesses=10
parallelprocesses=2
parallelprocesses=-1
allowedinputpaths={% for path in allowedinputpaths %}{{path}};{% endfor %}
default_mimetype={{ default_mimetype }}
json_indent={{ json_indent }}

[processing]
mode=docker
Expand Down
Loading