Skip to content

Commit

Permalink
Generate the WMTSCapabilities in c2cgeoportal
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Mar 23, 2016
1 parent a5fb29b commit c1baec6
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 19 deletions.
17 changes: 16 additions & 1 deletion c2cgeoportal/scaffolds/update/CONST_Makefile_tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ MOBILE ?= TRUE
NGEO ?= FALSE
# Use TileCloud chain
TILECLOUD_CHAIN ?= TRUE
TILECLOUD_CHAIN_LOCAL ?= FALSE
# Used print version
PRINT_VERSION ?= 3

Expand All @@ -40,7 +41,14 @@ WEB_RULE ?= $(DEFAULT_WEB_RULE)

DEFAULT_BUILD_RULES ?= test-packages .build/requirements.timestamp $(WEB_RULE) build-server apache
ifeq ($(TILECLOUD_CHAIN), TRUE)
DEFAULT_BUILD_RULES += test-packages-tilecloud-chain apache/tiles.conf
WMTSCAPABILITIES_PATH ?= 1.0.0/WMTSCapabilities-$(INSTANCE_ID).xml
WMTSCAPABILITIES_FILE ?= /var/sig/tiles/$(WMTSCAPABILITIES_PATH)

DEFAULT_BUILD_RULES += test-packages-tilecloud-chain apache/tiles.conf tilegeneration/config.yaml
ENVIRONMENT_VARS += WMTSCAPABILITIES_PATH=${WMTSCAPABILITIES_PATH}
ifeq ($(TILECLOUD_CHAIN_LOCAL), TRUE)
DEFAULT_BUILD_RULES += $(WMTSCAPABILITIES_FILE)
endif
endif
ifeq ($(MOBILE), TRUE)
DEFAULT_BUILD_RULES += test-packages-mobile
Expand Down Expand Up @@ -364,6 +372,9 @@ clean: template-clean
$(TOMCAT_OUTPUT_CMD_PREFIX) rm -f $(PRINT_OUTPUT)/$(PRINT_WAR)
$(TOMCAT_OUTPUT_CMD_PREFIX) rm -rf $(PRINT_OUTPUT)/$(PRINT_WAR:.war=)
rm -f $(APACHE_CONF_DIR)/$(INSTANCE_ID).conf
ifeq ($(TILECLOUD_CHAIN_LOCAL), TRUE)
rm -f $(WMTSCAPABILITIES_FILE)
endif

.PHONY: cleanall
cleanall: clean
Expand Down Expand Up @@ -813,3 +824,7 @@ upgrade3: .build/requirements.timestamp project.yaml
.PHONY: upgrade4
upgrade4: .build/requirements.timestamp project.yaml
$(VENV_BIN)/c2ctool upgrade $(UPGRADE_MAKE_FILE) ${UPGRADE_ARGS} ${VERSION} --step 4

# Tilecloud chain
$(WMTSCAPABILITIES_FILE): tilegeneration/config.yaml .build/dev-requirements.timestamp
$(VENV_BIN)/generate_controller --capabilities
2 changes: 2 additions & 0 deletions c2cgeoportal/scaffolds/update/CONST_vars.yaml_tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ vars:
- http://b.tiles.{host}/{instanceid}/tiles
- http://c.tiles.{host}/{instanceid}/tiles
- http://d.tiles.{host}/{instanceid}/tiles
wmtscapabilities_path: WMTSCAPABILITIES_PATH

# The URL template used to generate the sub domain URL
# %(sub)s will be replaced by the sub domain value.
Expand Down Expand Up @@ -324,3 +325,4 @@ interpreted:
- instanceid
- apache_entry_point
- development
- wmtscapabilities_path
26 changes: 8 additions & 18 deletions doc/integrator/make.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,34 +82,24 @@ Custom rules
------------

In the ``<package>.mk`` file we can create some other rules.
Here is a simple example that creates the
`/var/sig/tiles/1.0.0/WMTSCapabilities.xml` file
and removes it on the `clean` rule:
Here is a simple example:

.. code:: makefile
WMTSCAPABILITIES_FILE ?= /var/sig/tiles/1.0.0/WMTSCapabilities-$(INSTANCE_ID).xml
MY_FILE ?= <file>
PRE_RULES = $(WMTSCAPABILITIES_FILE)
PRE_RULES = $(MY_FILE)
$(WMTSCAPABILITIES_FILE): tilegeneration/config.yaml .build/dev-requirements.timestamp
$(VENV_BIN)/generate_controller --capabilities
$(MY_FILE): <source_file>
cp <source_file> $(MY_FILE)
# Short version:
# cp $< $@
clean: project-clean
.PHONY: project-clean
project-clean:
rm -f $(WMTSCAPABILITIES_FILE)
rm -f $(MY_FILE)
``tilegeneration/config.yaml`` and ``.build/dev-requirements.timestamp`` are the files
that must be built to run the current rule.

``$(VENV_BIN)/generate_controller --capabilities`` is the command that generates the wanted file.

And if you don't want the instance id in the production file you can put in your production mk file:

.. code:: makefile
WMTSCAPABILITIES_FILE = /var/sig/tiles/1.0.0/WMTSCapabilities.xml
Note
----
Expand Down
21 changes: 21 additions & 0 deletions doc/integrator/tilegeneration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,27 @@ Initialization

.build/venv/bin/pcreate --interactive -s tilecloud_chain ../<project> package=<package>

* In the ``<prokect>.mk`` activate the tile generation:

.. code::
TILECLOUD_CHAIN ?= TRUE
* If you use local cache activate the capabilities generation with:

.. code::
TILECLOUD_CHAIN_LOCAL ?= TRUE
and set the ``wmtscapabilities_file`` to ``${wmtscapabilities_path}`` in your
``tilegeneration/config.yaml.mako`` file.

* In your ``<prod>.mk`` you can also set the capabilities file name with:

.. code::
WMTSCAPABILITIES_PATH = 1.0.0/WMTSCapabilities.xml
* Add configuration to Git:

.. prompt:: bash
Expand Down

0 comments on commit c1baec6

Please sign in to comment.