A landing page for organisations wanting to connect and integrate their various geodata, geodata services and geospatial applications – view it in production: https://geo.sv.rostock.de
- Python (v3.x)
- Virtualenv (for Python 3)
- pip (for Python 3)
- Apache Solr
- ICU (International Components for Unicode) (i.e. icu-devtools)
- PostgreSQL
- Memcached
-
Create a new virtual Python environment, for example:
virtualenv -p python3 /usr/local/geolotse/virtualenv -
Clone the project:
git clone https://github.com/rostock/geolotse /usr/local/geolotse/geolotse -
Activate the virtual Python environment:
source /usr/local/geolotse/virtualenv/bin/activate -
Install the required Python modules via pip, the Python package management system:
pip install -r requirements.txt
-
Create a new secret settings file by copying the template for it:
cp /usr/local/geolotse/geolotse/secrets.template /usr/local/geolotse/geolotse/secrets.py -
Edit the secret settings file
-
Edit the general settings file
/usr/local/geolotse/geolotse/settings.py -
Edit all code sections marked with
ATTENTIONin file/usr/local/geolotse/geolotse/static/js/themes.js -
Edit the theme view map address search related settings in the respective sections of the file
/usr/local/geolotse/geolotse/static/js/themes.jsand the file/usr/local/geolotse/geolotse/geolotse.py
-
Activate the virtual Python environment:
source /usr/local/geolotse/virtualenv/bin/activate -
Create a new empty databse according to your settings in
/usr/local/geolotse/geolotse/settings.py -
Initialise the databse schema:
cd /usr/local/geolotse/geolotse export FLASK_APP=geolotse.py python -m flask db upgrade -
Deactivate the virtual Python environment:
deactivate -
Fill the databse with data, either by applying the
examples/database_pgsql.sqlas a starting point and/or for testing or by filling the database from scratch with your own data – the section on the database structure below might be helpful in either case -
Create a new empty Apache Solr core (as the Apache Solr user, usually
solr):sudo -H -u solr /path/to/solr/bin/solr create -c geolotse -
Open file
/path/to/solr/home/geolotse/conf/solrconfig.xmland remove below elements:<initParams path="/update/**">…</initParams> <processor class="solr.AddSchemaFieldsUpdateProcessorFactory">…</processor> -
Add below element to root element
<config>:<schemaFactory class="ClassicIndexSchemaFactory"/> -
Remove
managed-schemafile from the new Apache Solr core directory (as the Apache Solr user, usuallysolr):sudo -H -u solr rm /path/to/solr/home/geolotse/conf/managed-schema -
Copy the search schema to the new Apache Solr core directory (as the Apache Solr user, usually
solr):sudo -H -u solr cp /usr/local/geolotse/geolotse/solr/schema.xml /path/to/solr/home/geolotse/conf -
Make sure that both the user and the group of the search schema
/path/to/solr/home/geolotse/conf/schema.xmlmatch the user and the group of the other files within the new Apache Solr core directory (i.e. the Apache Solr user and its group, usuallysolranddaemon) -
Activate the virtual Python environment:
source /usr/local/geolotse/virtualenv/bin/activate -
Run the search index builder:
python search_index.py -
Create a cronjob to run the search index builder periodically and thus keeping the search index up-to-date
If you want to deploy geolotse with Apache HTTP Server you have to make sure that mod_wsgi is installed, a module that provides a Web Server Gateway Interface (WSGI) compliant interface for hosting Python based web applications. Then, you can follow these steps:
-
Create a new empty file
geolotse.wsgi:touch /usr/local/geolotse/geolotse/geolotse.wsgi -
Open
geolotse.wsgiand insert the following lines of code:import os activate_this = os.path.join('/usr/local/geolotse/virtualenv/bin/activate_this.py') with open(activate_this) as file_: exec(file_.read(), dict(__file__=activate_this)) from geolotse import app as application -
Open your Apache HTTP Server configuration file and insert something like this (in this example, the virtual Python environment uses a Python v3.6 interpreter):
WSGIDaemonProcess geolotse processes=2 threads=128 python-path=/usr/local/geolotse/geolotse:/usr/local/geolotse/virtualenv/lib/python3.6/site-packages WSGIProcessGroup geolotse WSGIScriptAlias /geolotse /usr/local/geolotse/geolotse/geolotse.wsgi process-group=geolotse <Directory /usr/local/geolotse/geolotse> Order deny,allow Require all granted </Directory>
-
Activate the virtual Python environment:
source /usr/local/geolotse/virtualenv/bin/activate -
Update the file
/usr/local/geolotse/geolotse/messages.potby extracting all translatable strings into it:cd /usr/local/geolotse/geolotse pybabel extract -F babel.cfg --omit-header -o messages.pot . -
Update all translation files (i.e. the
*.pofiles):pybabel update -i messages.pot -d translations -
Edit the
*.pofile(s) -
Compile the
*.pofile(s) – this will generate the required*.mo:pybabel compile -f -d translations
The database consists of four main tables:
links– All the links listed in the catalog view, shown as search results and/or used by themes are stored hereinspire– All the INSPIRE stuff related to the links goes heresublinks– All the sublinks related to the links are stored heretags– All the tags related to the links meet herethemes– All the themes presented in the theme view go here
The other tables are used for storing the relations between the four main tables (e.g. between links and tags). One of these tables, links_themes, provides more attributes than just the ID of the respective tables (see below).
A few details on the important attributes (i.e. fields):
parent_id– This integer field is mandatory since some logic within the code is based on it. The decision which link within acategoryand/orgroupis considered as theparenthas to be made wisely and the results differ within a categories and/or groups: play around and find out yourself or check theexamples/database_pgsql.sqlfor many examples. Always put an existingidin here since the value is checked within a foreign key constraintcategory– This text field is mandatory since some logic within the code is based on it. The value shall be one ofapi(for API, i.e. application programming interfaces),application(for applications),documentation(for documentations, i.e. documentation websites),download(for downloads, i.e. download portals),external(for external links),form(for forms),geoservice(for geo services) orhelper(for helpers, i.e. tools)category_order– This small integer field is mandatory since it determines the order of link categories in the catalog view and thus some logic within the code is based on it. Always use the same value for all links of onecategory, e.g. if the applications should appear first in the catalog view, all the application links have to have thecategory_ordervalue1group– This text field is mandatory since some logic within the code is based on it. The value depends from thecategory: for applications, external links and helpers (i.e. tools), the value is considered as the parent title; for geo services, the value is considered as the service type (e.g. INSPIRE Download Service, WMS, WFS, INSPIRE View Service, WMTS etc.); for API (i.e. application programming interfaces), documentations (i.e. documentation websites), downloads (i.e. download portals) and forms, the value has no relevance and shall be set to thecategoryvaluegroup_order– This small integer field is mandatory since some logic within the code is based on it. The value depends from thecategory: for applications, external links and helpers (i.e. tools), the value determines the order of the link within itsgroup, i.e.1for the first link,2for the second and so on; for geo services, the value determines the order of service types in the catalog view (always use the same value for all geo service links of onegroup(i.e. service type), e.g. if the geo service links of the service type WMS should appear first in the catalog view, all the geo service links of the service type WMS have to have thegroup_ordervalue1); for API (i.e. application programming interfaces), documentations (i.e. documentation websites), downloads (i.e. download portals) and forms, the value has no relevance and shall be set to1title– This text field is mandatory since every link needs a title, i.e. a name – but not necessarily an unique onelink– This text field is mandatory since this is the link itselfpublic– The valueFALSEin this boolean field means “This link is not publicly available.”, the valueTRUEhowever means “This link is publicly available.”. The field is mandatory since some logic within the code is based on itdescription– The description of the link and/or its target goes in this text field. The information is used in the catalog viewdate– The date the link and/or its target was last updated is stored in this date field. The information is used in the catalog viewauthorship_organisation– The organisation(s) of the author(s) of the link and/or its target go(es) in this text array field. The order has to be the same as in theauthorship_nameandauthorship_mailfields since all these three fields are evaluated together in the code. The information is used in the catalog viewauthorship_name– The name(s) of the author(s) of the link and/or its target go(es) in this text array field. The order has to be the same as in theauthorship_organisationandauthorship_mailfields since all these three fields are evaluated together in the code. The information is used in the catalog viewauthorship_mail– The email address(es) of the author(s) of the link and/or its target go(es) in this text array field. The order has to be the same as in theauthorship_organisationandauthorship_namefields since all these three fields are evaluated together in the code. The information is used in the catalog viewlogo– If you want a link categorised asapplicationand withparent_idequallingidto be equipped with a logo in the catalog view, its file name (with extension) has to go in this text field. Put the logo file itself in thestatic/images/logosfolder. Logo information for links with other categories thanapplicationis not evaluatedsearch– The valueFALSEin this boolean field means “This link is considered as a search result and thus included in the search index.”, the valueTRUEhowever means “This link is not considered as a search result and thus not included in the search index.”. The field is mandatory since some logic within the code is based on itsearch_title– If you want a link categorised asapplicationto have a different title than the value ofgroupin the search result list, the title hat to go in this text field
Always think of the relations between links and sublinks, the relations between links and tags and the relations between links and themes if you insert, delete or update links, especially by a bot (e.g. a cronjob)!
A few details on the important attributes (i.e. fields):
top– If this boolean field isTRUE, then the link is considered as one of the “top offers” for the related theme in theme view and thus its features or maps are shown on the map once the theme is selected.type– The type of the link and/or its target goes in this text field. The value shall be one ofCitySDK(for CitySDK conformal interfaces),WFS(for Web Feature Services) orWMS(for Web Map Services). The information is used for showing features or maps on the map in the theme viewlayer– IftypeisWFSorWMS, the name of the feature type (WFS) or layer (WMS) that shall be used goes in this text field. The information is used for showing features or maps on the map in the theme view
Only if type and – for WFS and WMS – layer additionally is/are provided, the features or maps of the link will be shown on the map in theme view!
A few details on the important attributes (i.e. fields):
annex– This small integer field is mandatory since it determines the annex of the INSPIRE theme (i.e.1,2or3)short– The two (upper case) characters abbreviation of the INSPIRE theme (e.g.USforUtility and governmental services) goes in this mandatory text fieldtheme_de– This text field is mandatory and contains the INSPIRE theme in German (e.g.Schutzgebiete)theme_en– This text field is mandatory and contains the INSPIRE theme in English (e.g.Utility and governmental services)link– This text field is mandatory and contains the link to the INSPIRE theme (e.g.https://inspire.ec.europa.eu/theme/usforUtility and governmental services)
Always think of the relations between links and tags if you insert, delete or update tags, especially by a bot (e.g. a cronjob)!
A few details on the important attributes (i.e. fields):
target– This text field is mandatory since some logic within the code is based on it. The value shall be one ofmetadata(for sublinks leading to metadata of links, e.g. a specific page in a metadata information system),geoportal(for sublinks leading to the representation of links in a geodata portal),geoportal_mobile(for sublinks leading to the representation of links in a mobile geodata portal) oropendata(for sublinks leading to the representation of links in an open data portal)title– This text field is mandatory since every sublink needs a title, i.e. a name – but not necessarily an unique onelink– This text field is mandatory since this is the sublink itselfpublic– The valueFALSEin this boolean field means “This sublink is not publicly available.”, the valueTRUEhowever means “This sublink is publicly available.”. The field is mandatory since some logic within the code is based on it
Always think of the relations between links and sublinks if you insert, delete or update sublinks, especially by a bot (e.g. a cronjob)!
A few details on the important attributes (i.e. fields):
title– This text field is mandatory since this is the tag itselfauto– The valueFALSEin this boolean field means something like “This tag shall be kept in this table until it is deleted by the administrator.”, the valueTRUEhowever means something like “This tag is rather volatile and may be deleted or updated by a bot (e.g. a cronjob).”. The field is mandatory since some external logic can be built upon its value (e.g. a cronjob could visit all your geo service links, automatically collect all of the related tags, remove all the tags whereautoisFALSEand finally insert all the collected tags)
Always think of the relations between links and tags if you insert, delete or update tags, especially by a bot (e.g. a cronjob)!
A few details on the important attributes (i.e. fields):
title– This text field is mandatory since every theme needs a unique titledescriptive_tags– The descriptive tag(s) for the theme go(es) in this text array field. The information is used in the theme view theme slidericon– If you want a theme to be equipped with an unique icon in the theme view, its Font Awesome name (e.g.train) has to go in this text array field. The order of the array items in this field is kept
Always think of the relations between links and themes if you insert, delete or update tags, especially by a bot (e.g. a cronjob)!