Permalink
Browse files

#255 gradle enabling the simple tile server. this build will fail due…

…e to gradle-fury issue 46. merging will have to wait
  • Loading branch information...
spyhunter99 committed Dec 24, 2016
1 parent 0d99213 commit b9b87dffe2ad353918d20681a29618fb8fca86a4
@@ -3,25 +3,31 @@ A simple Java server that serves up OSM Sqlite database files. This tool
will serve up map tiles stored in a osmdroid sqlite database created by [MOBAC](http://mobac.sourceforge.net/).
# Usage Scenario
-This tool is not designed for a high volume, production scale system. It's most appropriate for testing, development and disconnected (from the internet) environments where you needed to serve up map tiles quickly and don't want to generate tiles using the Open Street Map database and associated tooling. This tool is not meant to be internet facing.
+This tool is not designed for a high volume, production scale systems. It's most appropriate for testing, development and disconnected (from the internet) environments where you needed to serve up map tiles quickly and don't want to generate tiles using the Open Street Map database and associated tooling. This tool is not meant to be internet facing.
+
+# Why?
+Primarily for those want to test osmdroid on a network that can't reach the internet.
# Usage
## Preparing your tile databases
Fire up MOBAC and create an [OsmDroid](https://github.com/osmdroid/osmdroid) sqlite database. Use 256x256pixel tiles.
## Build
-`git clone `https://github.com/....../....git`
+`git clone `https://github.com/osmdroid/osmdroid.git`
-`mvn clean install`
+`gradlew install`
## configure
`vi sources.properties`
Add in whatever OsmDroid style Sqlite database files that you have using the example. A very small example database using the USGS Topographic maps is provided.
## Start it up
-`java -jar target/OpenStreetMapsTileServer-<version>-jar-with-dependencies.jar (optional port, default 80)`
+
+`java -jar target/osmdroid-server-jdk-<version>-jar-with-dependencies.jar (optional port, default 80)`
+
+`../gradlew run <port>`
Point browser to: http://localhost:port/, tile sources can be changed using the drop down menu.
@@ -0,0 +1,61 @@
+apply plugin: 'java'
+apply plugin: 'distribution'
+apply plugin: 'application'
+apply plugin: 'maven'
+apply plugin: 'war'
+
+mainClassName = "org.osmdroid.server.jdk.TileServer"
+
+war {
+ from('www') {
+
+ }
+}
+
+distributions {
+ main {
+ contents {
+ into('bin/www') {
+ from 'www'
+ }
+ into('bin') {
+ from "$projectDir.absolutePath/LICENSE-OpenLayers"
+ from "$rootDir.absolutePath/LICENSE"
+ from "$projectDir.absolutePath/README.md"
+ from "$projectDir.absolutePath/sources.properties"
+ from "$projectDir.absolutePath/usgstopo-grandcanyon.sqlite"
+ }
+ }
+ }
+}
+
+
+description = "OpenStreetMaps Tile Server (JRE)"
+configurations.all {
+ resolutionStrategy{
+ force 'javax.ws.rs:javax.ws.rs-api:2.0','javax.ws.rs:javax.ws.rs-api:2.0-m10'
+ force 'javax.ws.rs:javax.ws.rs-api:2.0-m10','javax.ws.rs:javax.ws.rs-api:2.0-m10'
+ }
+}
+dependencies {
+ compile group: 'javax.servlet', name: 'servlet-api', version:'2.5'
+ compile group: 'commons-configuration', name: 'commons-configuration', version:'1.9'
+ compile group: 'org.apache.commons', name: 'commons-lang3', version:'3.1'
+ compile group: 'commons-collections', name: 'commons-collections', version:'3.2'
+ compile group: 'org.apache.cxf', name: 'cxf-bundle-jaxrs', version:'2.7.5'
+ compile group: 'org.springframework', name: 'spring-test', version:'3.2.2.RELEASE'
+ compile group: 'org.springframework', name: 'spring-context', version:'3.2.2.RELEASE'
+ compile group: 'commons-codec', name: 'commons-codec', version:'1.3'
+ // compile group: 'org.apache.geronimo.specs', name: 'geronimo-jaxrs_1.1_spec', version:'1.0'
+ compile group: 'org.apache.cxf', name: 'cxf-rt-rs-extension-providers', version:'2.7.5'
+ compile group: 'org.xerial', name: 'sqlite-jdbc', version:'3.8.7'
+ compile group: 'javax.servlet.jsp', name: 'jsp-api', version:'2.1'
+ compile group: 'org.glassfish.jersey.containers', name: 'jersey-container-servlet', version:'2.5.1'
+ compile group: 'org.glassfish.jersey.core', name: 'jersey-client', version:'2.5.1'
+ compile group: 'org.glassfish.jersey.media', name: 'jersey-media-moxy', version:'2.5.1'
+ compile group: 'org.apache.cxf', name: 'cxf-rt-transports-http-jetty', version:'2.7.6'
+ compile group: 'org.slf4j', name: 'slf4j-jdk14', version:'1.7.10'
+ compile group: 'org.codehaus.jettison', name: 'jettison', version:'1.3.4'
+ compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version:'2.5.1'
+}
+
@@ -34,8 +34,16 @@ public static void main(String[] args) throws Exception {
System.out.println("Attempting to bind to " + ENDPOINT_ADDRESS);
startServer();
- System.out.println("Server started at " + ENDPOINT_ADDRESS + " press enter to stop.");
- System.console().readLine();
+
+ if (System.console()!=null) {
+ System.out.println("Server started at " + ENDPOINT_ADDRESS + " press enter to stop.");
+ System.console().readLine();
+ } else {
+ System.out.println("Server started at " + ENDPOINT_ADDRESS + " press Ctrl-C to stop.");
+ while (true){
+ Thread.sleep(5000);
+ }
+ }
server.stop();
server.destroy();
@@ -93,7 +93,7 @@ <h1>Loading map sources...</h1>
,
view: new ol.View({
center: [-472202, 7530279],
- zoom: 3
+ zoom: 1
})
});
View
@@ -15,6 +15,7 @@ include ':osmdroid-forge-app'
//jdk specific tools and applications
include ':OSMMapTilePackager'
+include ':osmdroid-server-jdk'
//dist package
include ':osmdroid-dist'

0 comments on commit b9b87df

Please sign in to comment.