Skip to content

Commit

Permalink
Merge pull request #4514 from geoadmin/develop-2024-12-18
Browse files Browse the repository at this point in the history
New Release 2024-12-18-rc1
  • Loading branch information
rebert authored Dec 17, 2024
2 parents 3ef3f37 + adb3476 commit 05da83a
Show file tree
Hide file tree
Showing 72 changed files with 372 additions and 487 deletions.
18 changes: 9 additions & 9 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@ cachetools = "~=5.2"
decorator = "~=5.1"
esrijson = "~=0.4"
gatilegrid = "~=0.2"
geojson = "~=2.5"
lark_parser = "~=0.7.8"
geojson = "~=3.0"
lark_parser = "~=0.12.0"
networkx = "~=2.8"
papyrus = "~=2.4"
papyrus = "==2.5"
SQLAlchemy = "~=1.4.48"
GeoAlchemy2 = "~=0.13.0"
Pillow = "~=9.2"
polib = "~=1.1"
psycopg2-binary = "~=2.9"
pyproj = "~=3.4"
pyproj = "==3.6.1"
pyramid = "~=2.0"
pyramid-mako = "~=1.1"
pyramid-tm = "~=2.5"
Expand All @@ -28,15 +27,16 @@ pytz = "~=2022.4"
PyYAML = "~=6.0"
regex = "~=2022.9.13"
requests = "~=2.28"
Shapely = "~=1.8"
Shapely = "~=2.0"
numpy = "==2.0.2"
simplejson = "~=3.17"
unidecode = "~=1.3"
Akhet = "~=2.0"
logging-utilities = "~=3.1.1"
pyramid-exclog = "~=1.1"
GeoAlchemy2 = "==0.13.3"

[dev-packages]
waitress = "~=2.1"
waitress = "~=3.0"
PyRSS2Gen = "~=1.1"
flake8 = "*"
pep8 = "*"
Expand All @@ -51,7 +51,7 @@ Sphinx = "~=5.2"
sphinx-rtd-theme = "~=1.0"
nose2 = "*"
coverage = "~=4.5"
numpy = "*"
numpy = "==2.0.2"
requests-mock = "~=1.12.1"

[requires]
Expand Down
196 changes: 122 additions & 74 deletions Pipfile.lock

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ make setup
Build the Pylons settings files and run the local `waitress` server

```bash
summon make serve
summon -p ssm make serve
```

You may want to customize the variables. Copy the file `.env.default` as `.ven.mine`,
change the variables you want and use them with

```bash
summon make ENV_FILE=.env.mine serve
summon -p ssm make ENV_FILE=.env.mine serve
```

:book: You need some external ressource to run the service, see [External ressources dependencies](#external-ressources-dependencies)
Expand All @@ -71,7 +71,7 @@ You can use the ssh port forwarding feature to have access to `pg-geodata-replic
ssh ssh0a.prod.bgdi.ch -L 5432:pg-geodata-replica.bgdi.ch:5432
```

Then set the `DBHOST` environment variable to `localhost` (you can do this in your own environment file e.g. `.env.mine` and run the make file as follow: `summon make ENV_FILE=.env.mine serve`)
Then set the `DBHOST` environment variable to `localhost` (you can do this in your own environment file e.g. `.env.mine` and run the make file as follow: `summon -p ssm make ENV_FILE=.env.mine serve`)

### S3 Vector Bucket Access

Expand All @@ -96,7 +96,7 @@ make dockerbuild
### Docker run locally

```bash
summon make dockerrun
summon -p ssm make dockerrun
```

:book: You need some external ressource to run the service, see [External ressources dependencies](#external-ressources-dependencies)
Expand Down Expand Up @@ -130,19 +130,19 @@ See [External Ressources Dependencies](#external-ressources-dependencies) for mo
To run the tests enter

```bash
summon make test
summon -p ssm make test
```

Or if you use your own environment file

```bash
summon make ENV_FILE=.env.mine test
summon -p ssm make ENV_FILE=.env.mine test
```

**:warning: If you don't have AWS Access you can disable the S3 tests as follow**

```bash
summon make S3_TESTS=0 test
summon -p ssm make S3_TESTS=0 test
```

## Download WMS image legends
Expand Down
19 changes: 19 additions & 0 deletions apache/wsgi-py3.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,32 @@ WSGIPassAuthorization On
# Redirect no-slash target to slashed version
RedirectMatch ^${APACHE_ENTRY_PATH}$ ${APACHE_ENTRY_PATH}/

# Info
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^${APACHE_ENTRY_PATH}/static/info\.json https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

# Info
RewriteRule ^${APACHE_ENTRY_PATH}/info.json ${APACHE_ENTRY_PATH}/static/info.json [PT]

# Static for cross domain flash/arcgis
RewriteRule ^${APACHE_ENTRY_PATH}/(crossdomain.xml|clientaccesspolicy.xml) ${APACHE_ENTRY_PATH}/static/$1 [PT]
<LocationMatch ^${APACHE_ENTRY_PATH}/static/(crossdomain.xml|clientaccesspolicy.xml)>
Header set Content-type "text/x-cross-domain-policy"
</LocationMatch>

# New style config url (see mf-geoadmin3 #4687)
RewriteRule ^${APACHE_ENTRY_PATH}/configs/(de|fr|it|rm|en)/layersConfig\.json ${APACHE_ENTRY_PATH}/rest/services/all/MapServer/layersConfig?lang=$1 [PT]
RewriteRule ^${APACHE_ENTRY_PATH}/configs/(de|fr|it|rm|en)/translations\.json ${APACHE_ENTRY_PATH}/rest/services/translations?lang=$1 [PT]
RewriteRule ^${APACHE_ENTRY_PATH}/configs/(de|fr|it|rm|en)/catalog\.(\w+)\.json ${APACHE_ENTRY_PATH}/rest/services/$2/CatalogServer?lang=$1 [PT]
RewriteRule ^${APACHE_ENTRY_PATH}/configs/(de|fr|it|rm|en)/services\.json ${APACHE_ENTRY_PATH}/rest/services [PT]
RewriteRule ^${APACHE_ENTRY_PATH}/configs/services\.json ${APACHE_ENTRY_PATH}/rest/services [PT]

# Robots static files
RewriteRule ^${APACHE_ENTRY_PATH}/robots.txt ${APACHE_ENTRY_PATH}/static/${ROBOTS_FILE} [PT]
<LocationMatch ^${APACHE_ENTRY_PATH}/static/(robots.txt|robots_dev.txt|robots_prod.txt)>
Header set Content-type "text/plain"
</LocationMatch>

############ WSGI #################################3

${LOAD_WSGI_MODULE_DIRECTIVE}
Expand Down
3 changes: 0 additions & 3 deletions chsdi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ def main(global_config, **settings):
request_method = tuple(settings.get('request_method').replace(' ', '').split(','))
config = Configurator(settings=settings, request_factory=WsgiSchemeAdaptedRequest)
config.include('pyramid_mako')
config.include('akhet.static')

# wrapper around all views
# This is a wrapper function around all views. If OPTIONS is given, an empty string will be returned
Expand Down Expand Up @@ -111,12 +110,10 @@ def datetime_adapter(obj, request):
config.add_route('translations', '/rest/services/translations', request_method=request_method)

config.add_route('stationboard', '/stationboard/stops/{id}', request_method=request_method)
config.add_route('faqlist', '/rest/services/{map}/faqlist', request_method=request_method)
config.add_route('color', '/color/{r},{g},{b}/{image}', request_method=request_method)

# Static route
static_max_age = int(settings['static_max_age']) if settings['static_max_age'] else None
config.add_static_route('chsdi', 'static', cache_max_age=static_max_age)

# Some views for specific routes
config.add_view(route_name='dev', renderer='chsdi:templates/index.mako')
Expand Down
6 changes: 3 additions & 3 deletions chsdi/lib/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
expression: WORD is_not_null
| WORD IS_NOT BOOLEAN
| WORD operators SIGNED_NUMBER
| WORD operators_likes ESCAPED_QUOTED_STRING
| WORD operators_likes ESCAPED_QUOTED_STRING
operators: OPERATORS -> ops
operators_likes: OPERATORS | LIKES
Expand Down Expand Up @@ -121,7 +121,7 @@ def operators_likes(self, s):

def BOOLEAN(self, s):
# log.debug(u'boolean: {}'.format(str(s)))
return "true" == str(s[0]).lower()
return "true" if s.lower() == "true" else "false"

def IS_NOT(self, s):
return str(s[0]).lower()
return s.lower()
20 changes: 0 additions & 20 deletions chsdi/models/vector/dritte.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,35 +145,15 @@ class AsylPlanning:
class AsylPlanningAnhoerung(Base, AsylPlanning, Vector):
__tablename__ = 'sachplan_asyl_plmeasures_anhorung'
__bodId__ = 'ch.sem.sachplan-asyl_anhoerung'
__minscale__ = 20005
__maxscale__ = 500005


class AsylPlanningRasterAnhoerung(Base, AsylPlanning, Vector):
__tablename__ = 'sachplan_asyl_plmeasures_r_anhorung'
__bodId__ = 'ch.sem.sachplan-asyl_anhoerung'
__maxscale__ = 20005
__minscale__ = 1


class AsylPlanningKraft(Base, AsylPlanning, Vector):
__tablename__ = 'sachplan_asyl_plmeasures_kraft'
__bodId__ = 'ch.sem.sachplan-asyl_kraft'
__minscale__ = 20005
__maxscale__ = 500005


class AsylPlanningRasterKraft(Base, AsylPlanning, Vector):
__tablename__ = 'sachplan_asyl_plmeasures_r_kraft'
__bodId__ = 'ch.sem.sachplan-asyl_kraft'
__maxscale__ = 20005
__minscale__ = 1


register('ch.sem.sachplan-asyl_anhoerung', AsylPlanningAnhoerung)
register('ch.sem.sachplan-asyl_anhoerung', AsylPlanningRasterAnhoerung)
register('ch.sem.sachplan-asyl_kraft', AsylPlanningKraft)
register('ch.sem.sachplan-asyl_kraft', AsylPlanningRasterKraft)


class ArmasuisseNaturLandschaftArmee(Base, Vector):
Expand Down
17 changes: 10 additions & 7 deletions chsdi/models/vector/evd.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class SachplanCernAnhoerungFac:
__table_args__ = ({'schema': 'sbfi', 'autoload': False})
__bodId__ = 'ch.sbfi.sachplan-cern_anhoerung'
__label__ = 'objname_de'
id = Column('bgdi_id', Integer, primary_key=True)
id = Column('stabil_id', Unicode, primary_key=True)
objname_de = Column('objname_de', Unicode)
objname_fr = Column('objname_fr', Unicode)
objname_it = Column('objname_it', Unicode)
Expand All @@ -262,25 +262,23 @@ class SachplanCernAnhoerungFac:

class SachplanCernAnhoerungFacPnt(Base, SachplanCernAnhoerungFac, Vector):
__tablename__ = 'sachplan_cern_anhoerung_fac_pnt'
__template__ = 'templates/htmlpopup/sbfi_sachplan_cern_anhoerung_pnt.mako'
__template__ = 'templates/htmlpopup/sbfi_sachplan_cern_anhoerung_fac_pnt.mako'

register('ch.sbfi.sachplan-cern_anhoerung', SachplanCernAnhoerungFacPnt)


class SachplanCernAnhoerungFacLine(Base, SachplanCernAnhoerungFac, Vector):
__tablename__ = 'sachplan_cern_anhoerung_fac_line'
__template__ = 'templates/htmlpopup/sbfi_sachplan_cern_anhoerung_line.mako'
__template__ = 'templates/htmlpopup/sbfi_sachplan_cern_anhoerung_fac_line.mako'

register('ch.sbfi.sachplan-cern_anhoerung', SachplanCernAnhoerungFacLine)


class SachplanCernAnhoerungPlmPoly(Base, Vector):
__tablename__ = 'sachplan_cern_anhoerung_plm_poly'
class SachplanCernAnhoerungPlm:
__table_args__ = ({'schema': 'sbfi', 'autoload': False})
__bodId__ = 'ch.sbfi.sachplan-cern_anhoerung'
__template__ = 'templates/htmlpopup/sbfi_sachplan_cern_anhoerung_poly.mako'
__label__ = 'plname_de'
id = Column('bgdi_id', Integer, primary_key=True)
id = Column('stabil_id', Unicode, primary_key=True)
plname_de = Column('plname_de', Unicode)
plname_fr = Column('plname_fr', Unicode)
plname_it = Column('plname_it', Unicode)
Expand All @@ -306,6 +304,11 @@ class SachplanCernAnhoerungPlmPoly(Base, Vector):
doc_web_it = Column('doc_web_it', Unicode)
the_geom = Column(Geometry2D)


class SachplanCernAnhoerungPlmPoly(Base, SachplanCernAnhoerungPlm, Vector):
__tablename__ = 'sachplan_cern_anhoerung_plm_poly'
__template__ = 'templates/htmlpopup/sbfi_sachplan_cern_anhoerung_plm_poly.mako'

register('ch.sbfi.sachplan-cern_anhoerung', SachplanCernAnhoerungPlmPoly)


Expand Down
Loading

0 comments on commit 05da83a

Please sign in to comment.