Build up Webmapping Environment on Windows
This blog is about how to do web mapping with local database and server.
Tools:
- Java
- Apache Tomcat
- PostgreSQL
- GeoServer
Install Java
Install jdk-10.0.1_windows-x64_bin.exe
and jre-8u171-windows-i586.exe
Set system environment:
Variable | Value |
---|---|
JAVA_HOME | C:\Program Files (x86)\Java\jdk1.8.0_171 |
JAVA_BIN | %JAVA_HOME%\bin |
Check Java
in cmd
:
1 | java -version |
Deploy Apache Tomcat
Unzip apache-tomcat-9.0.8-windows-x64.zip
Set system environment:
Variable | Value |
---|---|
CATALINA_BASE | C:\apache-tomcat-9.0.8 |
CATALINA_BIN | C:\apache-tomcat-9.0.8\bin |
CATALINA_HOME | C:\apache-tomcat-9.0.8 |
Add users in C:\apache-tomcat-9.0.8\conf\tomcat-users.xml
:
1 | <role rolename="manager-gui"/> |
Chnage Tomcat port in C:\apache-tomcat-9.0.8\conf\server.xml
if 8080
is occupied:
1 | <Connector port="8090" protocol="HTTP/1.1" |
Increase Tomcat file size in C:\apache-tomcat-9.0.8\webapps\manager\WEB-INF\web.xml
:1
2<max-file-size>252428800</max-file-size>
<max-request-size>252428800</max-request-size>
Start server C:\apache-tomcat-9.0.8\bin\service.bat
Close your firewall.
Open localhost:8090
in a browser.
If Tomcat flashback, check Tomcat in debug mode:
1 | cd to\your\tomcat\bin |
Publish local geodata as WMS
Install PostgreSQL(Database) and PostGIS(a spatial database extender), and GeoServer.
Input Geodata (e.g. shape file) to PostgreSQL by PostGIS.
Login GeoServer http://localhost:8080/geoserver, click Stores
add data from database, click Layers
to publish a layer as WMS
, click Layer Groups
to organize Layers. Finally, click Layer preview
, open layers afrom OpenLayers
to preview.
Publish website
Finish your front-end codes (HTML, CSS, JS), include the WMS
in your JS codes. Open a command window on your website folder:1
jar -cvf webmapping.war *
Copy .war
to Tomcat webapps folder C:\apache-tomcat-9.0.8\webapps
. Start Tomcat server, login Tomcat with manager
account. Click Manager App
, then upload the .war
file in the WAR file to deploy
part and click deploy.
If everything works, click webmapping
to open the web application.
Reference
YouTube | Web mapping: PostGIS + Geoserver + QGis + Leaflet
stackoverflow | The connection was reset deploying geoserver.war in ubuntu
stackoverflow | Not able to deploy geoserver.war through apache tomcat