summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-07-16 13:20:41 (GMT)
committerDennis Nienhüser <nienhueser@kde.org>2016-07-16 13:20:41 (GMT)
commit06a8ef68e9ccbdde6154fbe0766a421b2b6c9d52 (patch)
treed6f8f56d21cc7bfb3a05c2deb631f615b62e946a
parenta927ef05ca0e68db6b054bbecfe17e0861017f8a (diff)
Fix cache directory usage
-rw-r--r--src/lib/marble/geodata/writer/GeoWriter.cpp4
-rw-r--r--src/plugins/runner/osm/CMakeLists.txt1
-rw-r--r--tools/kml2kml/kml2kml.cpp6
-rw-r--r--tools/natural-earth-vector-tiling/ne_tilegenerator.py14
-rwxr-xr-xtools/vectortilecreator/vectortilecreator.py6
5 files changed, 21 insertions, 10 deletions
diff --git a/src/lib/marble/geodata/writer/GeoWriter.cpp b/src/lib/marble/geodata/writer/GeoWriter.cpp
index 2a126ff..b7160d1 100644
--- a/src/lib/marble/geodata/writer/GeoWriter.cpp
+++ b/src/lib/marble/geodata/writer/GeoWriter.cpp
@@ -29,6 +29,10 @@ GeoWriter::GeoWriter()
bool GeoWriter::write(QIODevice* device, const GeoNode *feature)
{
setDevice( device );
+ if (m_documentType == "o5m") {
+ return writeElement(feature);
+ }
+
setAutoFormatting( true );
writeStartDocument();
diff --git a/src/plugins/runner/osm/CMakeLists.txt b/src/plugins/runner/osm/CMakeLists.txt
index f5b27ec..34b5c83 100644
--- a/src/plugins/runner/osm/CMakeLists.txt
+++ b/src/plugins/runner/osm/CMakeLists.txt
@@ -17,6 +17,7 @@ set( osm_writers_SRCS
)
set( osm_translators_SRCS
translators/OsmDocumentTagTranslator.cpp
+ translators/O5mWriter.cpp
)
set( osm_SRCS
diff --git a/tools/kml2kml/kml2kml.cpp b/tools/kml2kml/kml2kml.cpp
index 86209b1..7260082 100644
--- a/tools/kml2kml/kml2kml.cpp
+++ b/tools/kml2kml/kml2kml.cpp
@@ -36,7 +36,7 @@ int main(int argc, char** argv)
return 1;
}
- QString outputFilename = "output.kml";
+ QString outputFilename = "output.o5m";
int outputIndex = app.arguments().indexOf("-o");
if ( outputIndex > 0 && outputIndex + 1 < argc )
outputFilename = app.arguments().at( outputIndex + 1 );
@@ -55,5 +55,7 @@ int main(int argc, char** argv)
return 3;
}
- GeoWriter().write(&output, dynamic_cast<GeoDataFeature*>(document));
+ GeoWriter writer;
+ writer.setDocumentType("o5m");
+ writer.write(&output, dynamic_cast<GeoDataFeature*>(document));
}
diff --git a/tools/natural-earth-vector-tiling/ne_tilegenerator.py b/tools/natural-earth-vector-tiling/ne_tilegenerator.py
index 038b20a..47cacf0 100644
--- a/tools/natural-earth-vector-tiling/ne_tilegenerator.py
+++ b/tools/natural-earth-vector-tiling/ne_tilegenerator.py
@@ -21,9 +21,9 @@ import argparse
import urllib3
import zipfile
sys.path.append('../shp2osm')
-sys.path.append('../vectortilecreator')
import polyshp2osm
-import vectortilecreator
+from subprocess import call
+
def unzip_file(filename, in_dir):
print(in_dir)
@@ -124,9 +124,13 @@ if __name__ == "__main__":
path = os.path.join(args.in_dir, filename) + '/' + filename + '_shp.shp'
abs_file_paths.append(path)
print('Level has following SHP datasets: ', abs_file_paths)
- polyshp2osm.run(abs_file_paths, 1, 5000000, 'tiny_planet_{}'.format(level))
- print('Tiny planetosm for Level = {} complete.'.format(level))
+ tinyPlanet = 'tiny_planet_{}'.format(level)
+ if args.overwrite or not os.path.exists(tinyPlanet):
+ polyshp2osm.run(abs_file_paths, 1, 5000000, tinyPlanet)
+ print('Tiny planetosm for Level = {} complete.'.format(level))
f = open('bound_info_{}'.format(level), "w")
print('tiny_planet_{}.1.osm;Level;-180.0;-86.0;180.0;86.0'.format(level), file=f)
f.close()
- vectortilecreator.run(['bound_info_{}'.format(level)], args.cache, args.refresh, args.out_dir, args.overwrite, [level])
+ #vectortilecreator.run(['bound_info_{}'.format(level)], args.cache, args.refresh, args.out_dir, args.overwrite, [level])
+ call(["osm-simplify", "-c", "-z", str(level), "-o", args.out_dir, '{}.1.osm'.format(tinyPlanet)])
+
diff --git a/tools/vectortilecreator/vectortilecreator.py b/tools/vectortilecreator/vectortilecreator.py
index 2273989..bc61ba9 100755
--- a/tools/vectortilecreator/vectortilecreator.py
+++ b/tools/vectortilecreator/vectortilecreator.py
@@ -113,7 +113,7 @@ class InputProvider(object):
print ("Creating cut out region {}\r".format(cutted), end='')
self.__createdFiles.add(cutted)
inputFile = self.__zoomOut(tile, zoom - 2)
- call(["osmconvert", "-t={}/osmconvert_tmp-".format(self._cacheDirectory), "--complete-ways", "--complex-ways", "--drop-version", "-b={},{},{},{}".format(baseTile.west(), baseTile.south(), baseTile.east(), baseTile.north()), "-o={}".format(cutted), os.path.join(self._cacheDirectory, inputFile)])
+ call(["osmconvert", "-t={}/osmconvert_tmp-".format(self._cacheDirectory), "--complete-ways", "--complex-ways", "--drop-version", "-b={},{},{},{}".format(baseTile.west(), baseTile.south(), baseTile.east(), baseTile.north()), "-o={}".format(cutted), inputFile])
return cutted
@@ -176,9 +176,9 @@ def run(filenames, cache, refresh, directory, overwrite, zoomLevels):
print ("{} level {}: {}/{} {}\r".format(bounds[1], zoom, count, total, os.path.join(path, target)), end='')
filterLevel = "levels/{}.level".format(zoom)
if os.path.exists(filterLevel):
- call(["osmconvert", "-t={}/osmconvert_tmp-".format(cache), "--complete-ways", "--complex-ways", "--drop-version", boxString, cutted, "-o={}".format(os.path.join(path, filterTarget))])
+ call(["osmconvert", "-t={}/osmconvert_tmp-".format(cache), "--complete-ways", "--complex-ways", "--drop-version", boxString, cutted, "-o={}".format(os.path.join(cache, filterTarget))])
call(["osmfilter", "--parameter-file={}".format(filterLevel), os.path.join(path, filterTarget), "-o={}".format(os.path.join(path, target))])
- os.remove(os.path.join(path, filterTarget))
+ os.remove(os.path.join(cache, filterTarget))
else:
call(["osmconvert", "-t={}/osmconvert_tmp-".format(cache), "--complete-ways", "--complex-ways", "--drop-version", boxString, cutted, "-o={}".format(os.path.join(path, target))])
call(["chmod", "644", os.path.join(path, target)])