Fix, geht wieder (ist auf https gewechselt)

This commit is contained in:
Johannes Bialek 2020-06-08 14:53:36 +02:00
parent f669a63512
commit 832b3f6d2b
3 changed files with 27 additions and 13 deletions

View File

@ -9,6 +9,7 @@ repositories {
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.4.4'
compile group: 'commons-io', name: 'commons-io', version: '2.7'
}
application {

View File

@ -1,6 +1,7 @@
package de.daggit.domap.stitch
import groovy.util.logging.Log
import org.apache.commons.io.FileUtils
import javax.imageio.ImageIO
import java.awt.Graphics2D
@ -99,7 +100,14 @@ class Stitcher {
int retryCount = 3
for(;;) {
try {
tile.image = ImageIO.read(url)
File file = new File("$tmpDir/tile${u},${v}.gif")
if (!file.parentFile.exists()) {
file.parentFile.mkdirs();
}
FileUtils.copyURLToFile(url, file)
log.info("Saved $url to ${file.absolutePath} (Size: ${file?.size()}")
tile.imageFile = file
break
} catch (IOException ioe) {
retryCount--
@ -113,12 +121,19 @@ class Stitcher {
}
static void main(def args) {
println "Supported image formats: ${ImageIO.readerFormatNames.join(", ")}"
System.properties."http.proxyHost" = "172.16.136.10"
System.properties."http.proxyPort" = "8181"
System.properties."https.proxyHost" = "172.16.136.10"
System.properties."https.proxyPort" = "8181"
HttpURLConnection.setFollowRedirects(true)
//http://geoweb1.digistadtdo.de:80/OWSServiceProxy/bplan.sws?SEC_DATA=//fsgeop01/doris/Doris/BPLAN/Mengede/Mg131ooo01.map&LAYERS=Bebauungsplan&STYLES=&HEIGHT=520&WIDTH=923&SRS=EPSG%3A31466&FORMAT=image%2Fgif&TRANSPARENT=true&FEATUREINFO=true&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&BBOX=2596042.5177248,5715999.2721278,2596530.9382944,5716274.4386458
BufferedImage b1 = new Stitcher("http://geoweb1.digistadtdo.de:80/OWSServiceProxy/bplan.sws?SEC_DATA=//fsgeop01/doris/Doris/BPLAN/Mengede/Mg131ooo01.map&LAYERS=Bebauungsplan&STYLES=&SRS=EPSG%3A31466&FORMAT=image%2Fgif&TRANSPARENT=true&FEATUREINFO=true&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&BBOX=",
BufferedImage b1 = new Stitcher("https://geoweb1.digistadtdo.de/OWSServiceProxy/bplan.sws?SEC_DATA=//fsgeop01/doris/Doris/BPLAN/Mengede/Mg131ooo01.map&LAYERS=Bebauungsplan&STYLES=&SRS=EPSG%3A31466&FORMAT=image%2Fgif&TRANSPARENT=true&FEATUREINFO=true&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&BBOX=",
2596042.5177248,5715999.2721278
).load()
ImageIO.write(b1, "gif", new File("b1.gif"))
BufferedImage b2 = new Stitcher("http://geoweb1.digistadtdo.de:80/OWSServiceProxy/bplan.sws?SEC_DATA=//fsgeop01/doris/Doris/BPLAN/Mengede/Mg131ooo02.map&LAYERS=Bebauungsplan&STYLES=&SRS=EPSG%3A31466&FORMAT=image%2Fgif&TRANSPARENT=true&FEATUREINFO=true&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&BBOX=",
BufferedImage b2 = new Stitcher("https://geoweb1.digistadtdo.de/OWSServiceProxy/bplan.sws?SEC_DATA=//fsgeop01/doris/Doris/BPLAN/Mengede/Mg131ooo02.map&LAYERS=Bebauungsplan&STYLES=&SRS=EPSG%3A31466&FORMAT=image%2Fgif&TRANSPARENT=true&FEATUREINFO=true&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&BBOX=",
2596056.0014041,5715363.062297
).load()
ImageIO.write(b2, "gif", new File("b2.gif"))

View File

@ -1,11 +1,14 @@
package de.daggit.domap.stitch
import groovy.util.logging.Log
import javax.imageio.ImageIO
import java.awt.image.BufferedImage
/**
* Created by jbialek on 13.07.16.
*/
@Log
class Tile {
String tmpDir
int u
@ -16,7 +19,7 @@ class Tile {
double x2
double y2
File img
File imgFile
double getWidth() {
return x2-x1
@ -30,17 +33,12 @@ class Tile {
return [x1,y1,x2,y2].join(",")
}
void setImage(BufferedImage image) {
File tmp = new File("$tmpDir/tile${u},${v}.gif")
if (!tmp.parentFile.exists()) {
tmp.parentFile.mkdirs();
}
ImageIO.write(image, "gif", tmp)
img = tmp
void setImageFile(File file) {
imgFile = file
}
BufferedImage getImage() {
if (img.exists()) {
return ImageIO.read(img)
if (imgFile.exists()) {
return ImageIO.read(imgFile)
}
return null
}