It looks pretty nice. It would be even better if the PNGs were resized (or just added padding) to be power-of-two sizes. Unity, for example, won't apply the best compression unless images are pow2.
Tom
Creator of
Recent community posts
Just released this into early access exclusively here on itch.io
Legacy is a roleplaying, adventure, visual novel mix. Heavy on conversation and focus on bringing NPCs alive, such as them gossiping behind your back and remembering if you were rude the last time, the game is about exploration and discovery. As the player, you can discover plenty of hidden options and paths, as the character you will discover your family's past.
The game is currently unfinished, a true early access, but playable. It is released for Mac, Windows and Linux.
More info and downloads are here: https://lemuriaorg.itch.io/dragon-eye-legacy
Your JSON isn't proper GeoJSON. Here's a PHP script to translate to GeoJSON:
<?php
/*
when importing into QGIS, you want to simplify the linestring with a tolerance of about 0,00001 degrees
*/
if ($argc < 4 ) {
exit( "Usage: place_village lat lon scale - with scale in s, m, l\n" );
}
$fp = fopen("php://stdin", "r") or die("cannot open stdin");
$lat = floatval($argv[1]);
$lon = floatval($argv[2]);
// conversion:
// latitude = distance * 360 / (2*PI * 6400000)
// longitude = distance *360 * / (2*PI* cos(latitude) )
switch ($argv[3]) {
case 's':
case 'm':
$scale_lon = 0.5 * 360 / (2 * M_PI * 6400000); // for projection correction: ... 6400000 * cos($lat));
$scale_lat = 0.5 * 360 / (2 * M_PI * 6400000);
break;
case 'l':
default:
exit("scale must be one of s, m, l - instead of '".$argv[3]."'\n");
}
$input_data = file_get_contents("php://stdin");
$json = json_decode($input_data);
foreach ($json->features as &$feature) {
if (isset($feature->coordinates)) foreach ($feature->coordinates as &$coordinate) {
move_this($coordinate);
}
if (isset($feature->geometries)) foreach ($feature->geometries as &$geom) {
if (isset($geom->coordinates)) foreach ($geom->coordinates as &$coordinate) {
move_this($coordinate);
}
}
}
function move_this(&$coordinate) {
if (is_array($coordinate[0])) {
foreach ($coordinate as &$c) {
move_this($c);
}
} else {
global $lat, $lon, $scale_lat, $scale_lon;
$coordinate[0] = floatval($coordinate[0]) * $scale_lon + $lon;
// $coordinate[1] = -1 * floatval($coordinate[1]) + $y; // old pre-json-export files needed Y flipped
$coordinate[1] = floatval($coordinate[1]) * $scale_lat + $lat;
}
}
// now convert to GeoJSON
$new_features = array();
foreach ($json->features as &$feature) {
if (isset($feature->coordinates) && $feature->id != "earth") {
// buildings
$coords = close_rings($feature->coordinates);
$new_features[] = array("type"=>"Feature", "properties"=>array("id"=>$feature->id), "geometry"=>array("type"=>$feature->type, "coordinates"=>$coords));
}
if (isset($feature->geometries)) {
// roads
$coords = [];
foreach ($feature->geometries as $geom) {
$coords[] = $geom->coordinates;
}
// "type" is the GQIS road type string - here "local" for local roads
$new_features[] = array("type"=>"Feature", "properties"=>array("id"=>$feature->id, "type"=>"local"), "geometry"=>array("type"=>"MultiLineString", "coordinates"=>$coords));
}
}
$new_json = array("type"=>"FeatureCollection", "features"=>$new_features);
function close_rings($coordinates) {
if (is_array($coordinates[0][0])) {
$all = [];
foreach ($coordinates as $c) {
$all[] = close_rings($c);
}
return $all;
} else {
$coordinates[] = $coordinates[0];
}
return $coordinates;
}
echo json_encode($new_json, JSON_PRETTY_PRINT);
?>
Why not export the ward data? Just as polygons with a "type" field that says "building zone" or "park"? That would be INCREDIBLY useful for zooming in, where at distance only the wards are visible and then they fade into individual buildings as you zoom in, the way Google maps does it. And you could export the ward names that way as well.
Brilliant! It works now, QGIS can split the multipart into single parts. I can now add the 400 city maps to my game world. :)
(here's what my own conversion script managed: https://notveryprofessional.com/dragoneye/atlas/Phonas -- you'll see the problems in the town wall, for example).
Question: Do you export parks as well?
I think I know what you mean by awkward. You export all buildings as one object. That's not how GeoJSON works. The MultiPolygon should be split up, one polygon per building. MultiPolygon can be used for a city gate, which has two towers but they're part of the same building really.
There's also something wrong in the MultiPolygon that I can't quite figure out, but QGIS is unable to split it into single parts, which it should be able to do.
Nevertheless, it's a huge step forward, already better results than the svg2json script I wrote for myself.
@watabou - any chance to get access to the JSON before the desktop version? Here's a look at what I'm doing with it (zoom in on the city in the center, Phonas) - http://notveryprofessional.com/dragoneye/atlas/Phonas -- JSON would be perfect, at this low scale straight-out turning it into GeoJSON is ok because we're talking about a few mm of difference.
I'm happy with the most rough interface. I wrote a GeoJSON export for Azgaar's tool myself (he accepted the PR, so it's now in his codebase). If I understood this Haxe thing, I'd do the same here, but sadly I don't.
Would it be possible to add an export option to GeoJSON? It's not difficult to make it if you have the data, but SVG does not always translate cleanly to it and my converter tool is giving me ok, but not perfect results.
I'm asking because I am working with GIS systems and want the actual polygon data to import. SVG doesn't work in that context.
Do the opposite - if you can export to SVG, then things such as editing names is easy in an SVG editor and doesn't have to be in this one.
On the other hand, I'd wish for more control over size than just "small, medium, large" buttons. I have size data for my towns and would want a slider for population size or building number.