Application Properties
While many configuration and setup options are available through the Web Administration application
page, more fundamental (and security minded) changes to how the application operates are made using “Application Properties” defined by:Java System Properties
Web Application context parameters
System Environmental Variable.
As part of the operating environment GeoServer application properties, unlike settings, cannot be changed at runtime.
Setting Application property
Application properties are determined using the first value obtained from: Java System Properties, Web Application context parameters, or System Environmental Variable.
See also:
Using GEOSERVER_DATA_DIR
as an example:
Java System Properties: Supplied to the java virtual machine as part of your application server configuration.
-DGEOSERVER_DATA_DIR=/var/lib/geoserver_data
For Tomcat on linux edit
setenv.sh
to append additional java system properties:# Append system properties CATALINA_OPTS="${CATALINA_OPTS} -DGEOSERVER_DATA_DIR=/var/lib/geoserver_data"
For Tomcat on windows use Apache Tomcat Properties application, navigating to the Java tab to edit Java Options:
-DGEOSERVER_DATA_DIR=C:\ProgramData\GeoServer\data
While not commonly used for GEOSERVER_DATA_DIR, this approach is a popular way to enable/disable optional geoserver functionality.
See Set Java startup options for more details.
Web Application context parameter:
Recommended: Use your application server to configure the GeoServer web application via
conf/Catalina/localhost/geoserver.xml
file:<Context docBase="geoserver.war"> <Parameter name="GEOSERVER_DATA_DIR" value="/var/opt/geoserver/data" override="false"/> </Context>
This is the approach documented in our setup instructions for GEOSERVER_DATA_DIR and is recommended.
Note
Tomcat management of application properties as using
overide="false"
is not the most straight forward to understand. This setting prevents theWEB-INF/web.xml
included in thegeoserver.war
to overide the provided file location.Other application servers provide a user inteface to manage web application properties and are more intuitive.
Not recommended: Hand editing the webapps/geoservere/WEB-INF/web.xml file:
<context-param> <param-name>GEOSERVER_DATA_DIR</param-name> <param-value>/var/lib/geoserver_data</param-value> </context-param>
Note
This file is part of the GeoServer application and will be replaced when updating the application.
As a result this approach is error prone making updates more difficult and is not recommended.
Operating environmental variable:
export GEOSERVER_DATA_DIR=/var/lib/geoserver_data
This approach can be useful for GEOSERVER_DATA_DIR when running GeoServer in a docker container, traditionally managed with environmental variables.
GeoTools system properties
The GIS library used by GeoTools for working with spatial data has a number of configuration options avaialble as system properties.
Recommended:
org.geotools.referencing.forceXY=true
The official EPSG database specifies ordinates following the scientific tradition of most accurate value first. Many computer systems assume that the order should follow easting / northing order (corresponding to x / y pixel order on screen).
This setting is recommended for greater compatibility with a wider range of web services.
Reference: Axis Order
Optional:
org.geotools.referencing.operation.order=AreaFirst
When choosing a math transform between coordiante reference systems GeoTools defaults to an AccuracyFirst setting. For greater compatibility with PROJ systems an AreaFirst setting may be used, prioritizing math transforms that covers a larger area.
Reference: Coordinate operations tuning