Skip to content

Commit

Permalink
release 1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
klamann committed Jan 2, 2025
1 parent 581f020 commit 1329a1e
Show file tree
Hide file tree
Showing 17 changed files with 107 additions and 217 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@

# Changelog

### 1.0.2 (2025-01-02)

* switched to the current USGS servers since the previous domain was shut down

### 1.0.1 (2014-08-20)

* resolved an issue that prevented downloading heightmaps from USGS servers.
Expand Down
82 changes: 20 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ maps4cim is a map generator for the traffic simulation game
[Cities in Motion 2][CiM 2], which creates maps based on real parts of the
world.

The required source data for relief and inscriptions can be downloaded on demand
from free data sources. The elevations are directly integrated in the resulting
map, all further data (roads, forests, rivers, buildings, ...) are painted on
The required source data for relief and inscriptions can be downloaded on demand
from free data sources. The elevations are directly integrated in the resulting
map, all further data (roads, forests, rivers, buildings, ...) are painted on
the ground texture, so they can be recreated in the map editor.

## Core Features

* Create realistic maps based on real parts of the world, with data from these
free (as in [free beer and in free speech][open data]) data sources:
- [SRTM]: Elevations of the earth's surface with a resolution of about 90x90
- [SRTM]: Elevations of the earth's surface with a resolution of about 90x90
meters per data point. The data comes directly from the servers of the
[United States Geological Survey][USGS] (many thanks!)
- [OpenStreetMap]: Free map data from which the ground textures are generated
that will be shown on the resulting map. The required data for the selected
map sections is downloaded from the [Overpass]-Servers (with best regards
- [OpenStreetMap]: Free map data from which the ground textures are generated
that will be shown on the resulting map. The required data for the selected
map sections is downloaded from the [Overpass]-Servers (with best regards
to the operators!)
* Generate elevations from grayscale heightmaps
(with support for 16bit graphics)
Expand All @@ -33,7 +33,7 @@ the ground texture, so they can be recreated in the map editor.

You can get the latest binary release from GitHub:

* [maps4cim 1.0.1 on GitHub][github-release]
* [maps4cim on GitHub][github-release]

there were a few legitimate mirrors once, but many of them were taken over by scammers; this is the only reliable source.

Expand All @@ -47,6 +47,7 @@ there were a few legitimate mirrors once, but many of them were taken over by sc
(you can get the latest version from [java.com][Java]).
Mac users: *Don't* use your built-in "Java app" or something like that,
it will cause you trouble, even if maps4cim starts.
* Note that maps4cim is quite old by now and might not run on the latest java version. If you run into issues, try Java 8 ([Temurin](https://adoptium.net/temurin/releases/?version=8&package=jre) should work fine).

### Installation

Expand Down Expand Up @@ -75,7 +76,7 @@ right. Select a location on your hard drive and off we go!

maps4cim will download all required source data on the fly and the map will be
rendered for you. After 1-2 minutes, the flashing progress bar turns solid green
and your map is ready. Move your map to
and your map is ready. Move your map to
`C:\Users\MYNAME\AppData\LocalLow\Colossal Order\Cities in Motion 2\Maps`
(Windows) or `/Users/MYNAME/Library/Application Support/Colossal Order/` (Mac)
and start Cities in Motion 2. You can now edit your map in the map editor.
Expand All @@ -91,20 +92,13 @@ visit the forums (see links below). Have fun :)

## Discussion & Support

For more information, usage guides, technical support, praise and criticism,
please visit the forums:

* [citiesskylines.de][ForumDE] (german)

Unfortunately, the [cimexchange.com][ForumEN] forum was shut down for good, but you can post your questions in english language on [citiesskylines.de][ForumDE] as well.
All the forums for CiM 2 seem to be offline now. Feel free to [open a GitHub issue](https://github.com/klamann/maps4cim/issues) if you need support or have any comments.

## Get involved

[![build-img]][build]

maps4cim is free software and you can get the source code from github

> [github.com/Klamann/maps4cim.git](https://github.com/Klamann/maps4cim.git)
> [github.com/klamann/maps4cim.git](https://github.com/klamann/maps4cim.git)
Please note that this is still an early source code release, with important
parts of the code in an undocumented and sometimes rather dirty state,
Expand All @@ -121,47 +115,11 @@ Further information:

## Changelog

*1.0.1*

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

*1.0.0*

* New data sources:
- Grayscale heightmaps as source for elevations
- Arbitrary images as source for ground textures
- Custom OSM XML Files as source for ground textures
* Full Support for the European Cities DLC.
The building style of existing maps can be changed in the Metadata-Editor
* Performance of OpenStreetMap-Downloads improved, the hard download limits
were removed
* Windows-Executable (.exe-file) - note: Java is still required!
* Program Update Notifications
* Cache Janitor: removes deprecated and broken files from the cache
* Drastically improved error handling
* Useful new options in the settings menu (log file, updates, cache janitor, ...)
* Many small improvements and lots of bugfixes, see [CHANGELOG.md]

*0.9.3.1 beta*

* This is a bugfix release, it changes the default Overpass server to
overpass-api.de, because the previous server caused trouble, and improves
error handling for faulty OSM XML data
* Lots of awesome features are in the pipeline for the 1.0 release!

*0.9.3 beta*

* Map header format analyzed: Can now write correct file name, preview image and
creation date
* Metadata-Editor introduced: Change the preview picture and some other hidden
information about your maps!
* Usability-Improvements in the GUI

for the full changelog, see [CHANGELOG.md]
see [CHANGELOG.md]

## License

maps4cim is free software, distributed under the terms of the
maps4cim is free software, distributed under the terms of the
[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).

maps4cim - a real world map generator for CiM 2
Expand All @@ -181,12 +139,12 @@ maps4cim is free software, distributed under the terms of the



[CiM 2]: http://www.citiesinmotion2.com/ "Cities in Motion 2"
[SRTM]: http://www2.jpl.nasa.gov/srtm/ "Shuttle Radar Topography Mission"
[OpenStreetMap]: http://www.openstreetmap.org/ "OpenStreetMap"
[open data]: http://en.wikipedia.org/wiki/Open_data "Open Data (wikipedia.org)"
[USGS]: http://www.usgs.gov/ "United States Geological Survey"
[Overpass]: http://wiki.openstreetmap.org/wiki/Overpass_API "Overpass API"
[CiM 2]: https://www.citiesinmotion2.com/ "Cities in Motion 2"
[SRTM]: https://www.earthdata.nasa.gov/data/instruments/srtm "Shuttle Radar Topography Mission"
[OpenStreetMap]: https://www.openstreetmap.org/ "OpenStreetMap"
[open data]: https://en.wikipedia.org/wiki/Open_data "Open Data (wikipedia.org)"
[USGS]: https://www.usgs.gov/ "United States Geological Survey"
[Overpass]: https://wiki.openstreetmap.org/wiki/Overpass_API "Overpass API"
[splash]: https://raw.github.com/Klamann/maps4cim/master/maps4cim-gui/src/main/resources/de/nx42/maps4cim/res/img/splash-8bit.png "maps4cim"
[build]: https://travis-ci.org/Klamann/maps4cim
[build-img]: https://img.shields.io/travis/Klamann/maps4cim.svg
Expand Down
6 changes: 2 additions & 4 deletions docs/Deveopers.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ maps4cim source code.

You can get the source code from github

> [github.com/Klamann/maps4cim.git](https://github.com/Klamann/maps4cim.git)
> [github.com/klamann/maps4cim.git](https://github.com/klamann/maps4cim.git)
## Building the project

Expand Down Expand Up @@ -104,12 +104,10 @@ can be found in the [MapFileFormat.md](https://github.com/Klamann/maps4cim/blob/

Have an idea on how to improve maps4cim? You've already started writing code?
Great! Send a pull request, if you have results you think are worth sharing,
and feel free to contact me in the [forums][ForumEN] or via email:
<[email protected]>.
and feel free to contact me on GitHub or via email: <[email protected]>


[travis]: https://travis-ci.org/Klamann/maps4cim
[travis-img]: https://img.shields.io/travis/Klamann/maps4cim.svg
[coverity]: https://scan.coverity.com/projects/klamann-maps4cim
[coverity-img]: https://img.shields.io/coverity/scan/6533.svg
[ForumEN]: http://www.cimexchange.com/topic/2204-maps4cim-a-real-world-map-generator-for-cim-2/ "Support Thread in the cimexchange-forum (english)"
2 changes: 1 addition & 1 deletion 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.1</version>
<version>1.0.2</version>
<relativePath>../</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion 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.1</version>
<version>1.0.2</version>
<relativePath>../</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,11 @@ public class TileDownloadUSGS extends TileDownload {
private static final Logger log = LoggerFactory.getLogger(TileDownloadUSGS.class);

/*
* Map: https://dds.cr.usgs.gov/srtm/version2_1/Documentation/Continent_def.gif
* Base-URL: https://dds.cr.usgs.gov/srtm/version2_1/SRTM3/
* Base-URL: https://opendap.cr.usgs.gov/opendap/hyrax/DP109/SRTM/SRTMGL3.003/contents.html
*/

/**
* Maps from <Lat,Lon> to <DownloadURL>. Nonexisting tiles are not contained
* in this data structure.
*/
protected final Table<Integer,Integer,DownloadURL> downloadMapping;
protected final Cache cache = new Cache();

public TileDownloadUSGS() {
this.downloadMapping = loadMapping();
}

protected static Table<Integer,Integer,DownloadURL> loadMapping() {
try(InputStream serialized = ResourceLoader.getMappingSRTM();) {
Table<Integer,Integer,DownloadURL> mapping = ResourceLoader.deserializeObject(serialized);
Expand All @@ -73,106 +63,64 @@ protected static Table<Integer,Integer,DownloadURL> loadMapping() {

@Override
public boolean exists(int lat, int lon) {
return downloadMapping.contains(lat, lon);
throw new RuntimeException("website does not support HEAD requests...");
// URL src = getDownloadURL(lat, lon);
// return Network.exists(src);
}

@Override
public File getTile(int lat, int lon) throws IOException {

// return null reference, if tile does not exist (only sea level)
if(!exists(lat, lon)) {
log.warn("Tile ({},{}) is not covered in the SRTM dataset, so this part of the map will be flat.", lat, lon);
return null;
}

if(lat >= 59 || lat <= -59) {
log.warn("Tile ({},{}) is close to the boundaries of the SRTM dataset, the elevations may be incorrect.", lat, lon);
}

// search cache first, then download file if necessaray
// search cache first, then download file if necessary
String entry = DownloadURL.getFileName(lat, lon);
if(cache.has(entry)) {
log.debug("SRTM Tile ({},{}) has been loaded from cache.", lat, lon);
return cache.get(entry);
} else {
log.debug("Downloading SRTM Tile for ({},{}). It will be stored in cache for later use.", lat, lon);
return downloadTile(lat, lon);
try {
log.debug("Downloading SRTM Tile for ({},{}). It will be stored in cache for later use.", lat, lon);
return downloadTile(lat, lon);
} catch (IOException e) {
log.warn("Tile ({},{}) was not found. {}", lat, lon, e.getMessage());
return null;
}
}
}

protected File downloadTile(int lat, int lon) throws IOException {
URL src = getDownloadURL(lat, lon);
File temp = cache.allocate(DownloadURL.getFileName(lat, lon));

try {
Network.downloadToFile(src, temp);
} catch(FileNotFoundException e) {
// known URL failure, try alternative URLs...
src = downloadMapping.get(lat, lon).getAlternativeUrl(lat, lon);
Network.downloadToFile(src, temp);
}

Network.downloadToFile(src, temp);
File dest = cache.moveToCache(temp, true);
return dest;
}


protected URL getDownloadURL(int lat, int lon) {
DownloadURL dl = downloadMapping.get(lat, lon);
try {
return dl.getUrl(lat, lon);
return DownloadURL.getUrl(lat, lon);
} catch (MalformedURLException e) {
log.error(String.format("Could not create a valid SRTM download URL " +
"for (%s,%s).", lat, lon), e);
throw new RuntimeException("Creating of SRTM tile download URL failed");
}
}

// data structures specific for this class

protected enum DownloadURL {

Africa("Africa"),
Australia("Australia"),
Eurasia("Eurasia"),
Islands("Islands"),
North_America("North_America"),
South_America("South_America");
protected static class DownloadURL {

protected static final String protocol = "https";
protected static final String host = "dds.cr.usgs.gov";
protected static final String fileStart = "/srtm/version2_1/SRTM3/";
protected static final String ext = ".hgt.zip";

protected final String folder;

DownloadURL(String folder) {
this.folder = folder;
}

public String getFolder() {
return folder;
}

public URL getUrl(int lat, int lon) throws MalformedURLException {
return new URL(protocol, host, fileStart + folder + "/" + getNonationNSEW(lat, lon) + ext);
}

public URL getAlternativeUrl(int lat, int lon) throws MalformedURLException {
return new URL(protocol, host, fileStart + folder + "/" + getNonationNSEW(lat, lon) + ext.substring(1));
}
protected static final String host = "opendap.cr.usgs.gov";
protected static final String fileStart = "/opendap/hyrax/DP109/SRTM/SRTMGL3.003/2000.02.11/";
protected static final String ext = ".SRTMGL3.hgt.zip";

public URL getIndexURL() throws MalformedURLException {
return new URL(protocol, host, fileStart + folder);
public static URL getUrl(int lat, int lon) throws MalformedURLException {
return new URL(protocol, host, fileStart + getNonationNSEW(lat, lon) + ext);
}

public File getIndexLocal() {
try {
return new File(Resources.getResource("srtm/" + folder + ".html").toURI());
} catch (URISyntaxException e) {
log.error("Could not resolve path to local file", e);
return null;
}
public static URL getIndexURL() throws MalformedURLException {
return new URL(protocol, host, fileStart);
}

public static String getFileName(int lat, int lon) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,10 @@ public class OverpassBridge {

/** known public Overpass servers */
protected static final String[] servers = new String[] {
"http://overpass-api.de/api/interpreter?data=", // with gzip-support!
"http://overpass.osm.rambler.ru/cgi/interpreter?data=", // more powerful, but no gzip & sometimes buggy...
"http://api.openstreetmap.fr/oapi/interpreter?data=",
"http://overpass.osm.ch/api/interpreter?data=",
"http://overpass.openstreetmap.ie/api/interpreter?data=",
"https://overpass-api.de/api/interpreter?data=", // with gzip-support!
"https://overpass.osm.ch/api/interpreter?data=",
"https://overpass.private.coffee/api/interpreter?data=",
"https://overpass.osm.jp/api/interpreter?data=",
};

protected static final String queryBegin = "(";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ public class UpdateChecker {
private static final Logger log = LoggerFactory.getLogger(UpdateChecker.class);

protected static final String[] updateURLs = new String[] {
"http://raw.githubusercontent.com/Klamann/maps4cim/master/update.xml",
"http://nx42.de/projects/maps4cim/update/update.xml"
"https://raw.githubusercontent.com/klamann/maps4cim/master/update.xml",
};
protected static final String xmlFileName = "update.xml";

Expand Down
Loading

0 comments on commit 1329a1e

Please sign in to comment.