Skip to content

Commit

Permalink
bugfix release: 1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
klamann committed Aug 20, 2017
1 parent 16f1815 commit a321ae3
Show file tree
Hide file tree
Showing 37 changed files with 15,356 additions and 17,644 deletions.
21 changes: 16 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@

# Changelog

### 1.0.1 (2014-08-20)

* resolved an issue that prevented downloading heightmaps from USGS servers.

### 1.0.0 (2014-05-15)

* New data sources
Expand Down Expand Up @@ -120,16 +124,23 @@ release schedule: "when it's done"

### 1.0 stable

* done
* Add user agent for overpass API
* display overpass download link if request fails + better warning for huge maps

### 1.1 testing

* add new relief source: <http://www.viewfinderpanoramas.org/dem3.html>
* Select Overpass Server
* gui: map zoom buttons
* find out why names started sucking so hard... maybe need to analyze an empty map again -.-

### "when it's done"

* xml config: IDREF relation from entity to color
* selection inaccurate for large extents
* Select Overpass Server
* alternative SRTM source: <http://srtm.csi.cgiar.org/SELECTION/inputCoord.asp> (licensing issues, no file index available)
* store paths for config open/save, etc.
* Notification API
* gui: map zoom buttons, OSM attribution
* user input validation
* Finish HeightmapWindow
* Texture sources
Expand All @@ -138,6 +149,6 @@ release schedule: "when it's done"
- Custom Image: color mapping
* Global log-level switch for GUI-console output (verbose, default, off & show stacktrace
option would be nice -> warnings/errors are always shown!)
* Make XML schema-aware!
* Cleanup code
* Make XML schema-aware
* Write unit tests, where appropriate
* Cleanup code
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ Further information:

## Changelog

*1.0.1*

* resolved an issue that prevented downloading heightmaps from USGS servers.

*1.0.0*

* New data sources:
Expand Down Expand Up @@ -189,9 +193,9 @@ maps4cim is free software, distributed under the terms of the
[screen-game]: https://raw.github.com/Klamann/maps4cim/master/docs/ingame-screen.jpg
[Exchange]: http://www.cimexchange.com/files/file/694-maps4cim/ "Download maps4cim from cimexchange.com (english)"
[Filebase]: http://www.citiesskylines.de/filebase/index.php/Entry/382-maps4cim/ "Download maps4cim from citiesskylines.de (german)"
[github-release]: https://github.com/Klamann/maps4cim/releases/download/1.0.0/maps4cim-1.0.0.zip "Download maps4cim from github"
[github-release]: https://github.com/Klamann/maps4cim/releases/latest "Download maps4cim from github"
[ForumEN]: http://www.cimexchange.com/topic/2204-maps4cim-a-real-world-map-generator-for-cim-2/ "Support Thread in the cimexchange-forum (english)"
[ForumDE]: http://www.citiesskylines.de/index.php/Thread/2578-maps4cim-a-real-world-map-generator-for-CiM-2/?postID=31552 "Support Thread in the citiesinmotion.net-forum (german)"
[ForumDE]: http://www.citiesskylines.de/index.php/Thread/2578-maps4cim-a-real-world-map-generator-for-CiM-2/ "Support Thread in the citiesinmotion.net-forum (german)"
[Deveopers.md]: https://github.com/Klamann/maps4cim/blob/master/docs/Deveopers.md "Further information for developers"
[CHANGELOG.md]: https://github.com/Klamann/maps4cim/blob/master/CHANGELOG.md "maps4cim's changelog"
[docs]: https://github.com/Klamann/maps4cim/tree/master/docs "documentation for maps4cim"
Expand Down
8 changes: 4 additions & 4 deletions maps4cim-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>de.nx42.maps4cim</groupId>
<artifactId>maps4cim</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
<relativePath>../</relativePath>
</parent>

Expand Down Expand Up @@ -51,10 +51,10 @@
<!-- own build plugins -->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<version>3.0.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<source>1.7</source>
<target>1.7</target>
<archive>
<manifest>
<addClasspath>true</addClasspath>
Expand Down
18 changes: 12 additions & 6 deletions maps4cim-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>de.nx42.maps4cim</groupId>
<artifactId>maps4cim</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
<relativePath>../</relativePath>
</parent>

Expand All @@ -25,12 +25,12 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>17.0</version>
<version>23.0</version>
</dependency>
<dependency>
<groupId>org.openstreetmap.osmosis</groupId>
<artifactId>osmosis-xml</artifactId>
<version>0.43.1</version>
<version>0.45</version>
</dependency>
<dependency>
<groupId>gov.nih.imagej</groupId>
Expand All @@ -40,12 +40,18 @@
<dependency>
<groupId>com.github.jinahya</groupId>
<artifactId>bit-io</artifactId>
<version>1.1.2</version>
<version>1.1.4</version>
</dependency>
<dependency>
<groupId>net.sf.oval</groupId>
<artifactId>oval</artifactId>
<version>1.81</version>
<version>1.87</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.8.2</version>
<scope>test</scope>
</dependency>
</dependencies>

Expand All @@ -66,7 +72,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<version>3.0.2</version>
<configuration>
<archive>
<manifest>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import ch.qos.logback.core.rolling.FixedWindowRollingPolicy;
import ch.qos.logback.core.rolling.RollingFileAppender;
import ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy;
import ch.qos.logback.core.util.FileSize;
import ch.qos.logback.core.util.StatusPrinter;

import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -160,7 +161,7 @@ protected static FileAppender getFileAppender(File logFile) {

// rollover after logfixe exceeds 1MB
SizeBasedTriggeringPolicy triggeringPolicy = new SizeBasedTriggeringPolicy();
triggeringPolicy.setMaxFileSize("1MB");
triggeringPolicy.setMaxFileSize(FileSize.valueOf("1mb"));
triggeringPolicy.start();

// layout of the log entries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public static ResourceBundle getMessages() {
*/
public static byte[] readBase64Resource(String path) throws IllegalArgumentException, IOException {
String base64 = Resources.toString(Resources.getResource(path), Charsets.UTF_8);
String trimmed = CharMatcher.WHITESPACE.removeFrom(base64);
String trimmed = CharMatcher.whitespace().removeFrom(base64);
return BaseEncoding.base64().decode(trimmed);
}

Expand Down
27 changes: 16 additions & 11 deletions maps4cim-core/src/main/java/de/nx42/maps4cim/map/relief/SRTM.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;

import org.slf4j.LoggerFactory;

import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteStreams;
import com.google.common.io.Files;

import org.slf4j.LoggerFactory;

import de.nx42.maps4cim.config.Config;
import de.nx42.maps4cim.config.relief.SrtmDef;
import de.nx42.maps4cim.map.ReliefMap;
import de.nx42.maps4cim.map.ex.ReliefProcessingException;
import de.nx42.maps4cim.map.relief.srtm.TileDownload;
import de.nx42.maps4cim.map.relief.srtm.TileDownloadUSGS;
import de.nx42.maps4cim.util.Compression;
import de.nx42.maps4cim.util.arr2d.Arrays2D;
import de.nx42.maps4cim.util.arr2d.GapInterpolator;
Expand Down Expand Up @@ -253,7 +253,7 @@ protected float getValue(short[][] srtm, int x, int y) {

protected short[][] retrieveSRTMdata(Area ar) throws SocketTimeoutException, IOException, UnknownHostException {
// get source
TileDownload td = new TileDownload();
TileDownloadUSGS td = new TileDownloadUSGS();
File[][] files = td.getTiles(ar);

// transform to single short array
Expand All @@ -265,10 +265,7 @@ protected short[][] retrieveSRTMdata(Area ar) throws SocketTimeoutException, IOE
// multiple tiles, need to be combined
log.debug("combining {} tiles.", files.length * files[0].length);
short[][][][] source = unpackSRTMTiles(files);

// validate only, if within SRTM bounds
boolean validate = ar.getMaxLat() < 61 && ar.getMinLat() >= -60;
return Arrays2D.combine(source, 1, validate);
return Arrays2D.combine(source, 1, false);
}
}

Expand All @@ -295,7 +292,7 @@ protected short[][] getNativeSRTM(File input) throws IOException {

protected short[][] getNativeSRTM(byte[] input) throws IOException {
if(input == null || input.length == 0) {
return getEmptySRTMTile();
return getWaterSRTMTile();
}

ByteArrayDataInput badi = ByteStreams.newDataInput(input);
Expand All @@ -318,12 +315,20 @@ protected static byte[] readArchiveSRTM(File zipFile) throws IOException {
}
return Compression.readFirstZipEntry(zipFile);
}

protected short[][] getFlatSRTMTile() {
return getEmptySRTMTile((short) 1);
}

protected short[][] getWaterSRTMTile() {
return getEmptySRTMTile((short) -40);
}

protected short[][] getEmptySRTMTile() {
protected short[][] getEmptySRTMTile(short value) {
short[][] srtm = new short[srtmLength][srtmLength];
for (int y = 0; y < srtmLength; y++) {
for (int x = 0; x < srtmLength; x++) {
srtm[y][x] = 1;
srtm[y][x] = value;
}
}
return srtm;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package de.nx42.maps4cim.map.relief;

/**
* source: http://www.viewfinderpanoramas.org/dem3.html
*
*
*/
public class Viewfinder {

/*
* HGT File Format
* (source: http://www.viewfinderpanoramas.org/dem3.html#hgt)
*
* An HGT file covers an area of 1°x1°. Its south western corner can be
* deduced from its file name: for example, n51e002.hgt covers the area
* between N 51° E 2° and N 52° E 3°, and s14w077.hgt covers S 14° W 77° to
* S 13° W 76°. The file size depends on the resolution. If this is 1",
* there are 3601 rows of 3601 cells each; if it is 3", there are 1201 rows
* of 1201 cells each. The rows are laid out like text on a page, starting
* with the northernmost row, with each row reading from west to east. Each
* cell has two bytes, and the elevation at that cell is
* 256*(1st byte) + (2nd byte). It follows that a 3" HGT file has a file
* length of 2 x 1201 x 1201. SRTM 3" cells are calculated by calculating
* the mean of 1" cells and their eight neighbors.
* It follows that the highest local point is likely to be higher than the
* highest SRTM 3" cell. The difference should vary with the steepness of
* the local relief.
*/

/*
* Tile package URL retrieval
*
* OK, this is kinda messed up, as there is no proper tile package index
* available and the naming is totally inconsistent.
* This however is not the case for the tiles themselves, these are named
* consistently r"[n|s]\d\d[e|w]\d\d\d.hgt", e.g. "n51e002.hgt"
*
* A possible solution would be parsing the available overview maps
* - http://www.viewfinderpanoramas.org/Coverage%20map%20viewfinderpanoramas_org3.htm
* - http://www.imagico.de/files/ferranti.php
* - http://www.imagico.de/files/ferranti.php?list=dem1list.txt
* now we could deduce the locations from the pixels of the overview maps
*
* Better approach: read the package lists
* - http://www.viewfinderpanoramas.org/dem3list.txt
* - http://www.viewfinderpanoramas.org/dem1list.txt
* or get download links from this site:
* - http://www.imagico.de/map/demsearch.php
*
* These follow a specific pattern:
* id:path[:info], e.g. U22:/dem3/U22.zip or AN2:/ANTDEM3/16-30.zip:-90:-90:-60:-0
*
* id (tolowercase) can be:
* - "[n|s]\d\d[e|w]\d\d\d", e.g. n47e006: parse directly
* - "s?[a-z]\d\d", e.g. SM18: convert using algorithm below
* - otherwise: use coordinates from comment, see algorithm below
*
* short notation to available tiles:
* west-east in steps of 6°:
* 01 = 180..175°W, 02 = 174..169°W, 30 = 6..1°W, 31 = 0..5°E, 60 = 175..180°E
* north-south in steps of 4°:
* U = 80..83°N, A = 0..3°N, SA = 1..4°S, SN = 53..56°S
*
* comment to coordinates (e.g. "63:-25:67:-13")
* n63w25 to n66w14, last coordinates are exclusive!
*
* downloaded files can contain multiple .hgt files in several subfolders
* as well as unrelated files (readmes, etc.).
* To get all relevant data, list all files and filter with
* r"[n|s]\d\d[e|w]\d\d\d.hgt"
*
*
*
*
*/

}
Loading

0 comments on commit a321ae3

Please sign in to comment.