mapknitter-exporter 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/mapknitterExporter.rb +14 -13
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 89a5b76f3d5867d7ec0af78db1e7df96388a990d
|
|
4
|
+
data.tar.gz: fa3232bcb5378d0cb2eb7e189b617e7cc1005474
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: be7aaf40565549c1332f789e2af510dd8e00fbcbccbc19917a6420a1a4c914651dacb7ee0670ac71a24f4e3f13b58f85e56664b4841ab3cfcf9107f647ca5e3a
|
|
7
|
+
data.tar.gz: a270c38522ca390434e7e3718cb4c7f7fe4a3edba61200300c386d909e13ea1181f86c699551fbe7cd458de05ea0f69a7cf1ef83cfcb51341d92e1e4a6c5210c
|
data/lib/mapknitterExporter.rb
CHANGED
|
@@ -48,7 +48,7 @@ class MapKnitterExporter
|
|
|
48
48
|
# know everything -unwarped can be deleted
|
|
49
49
|
geotiff_location = directory + 'w' + id.to_s + '-geo-unwarped.tif'
|
|
50
50
|
# everything -geo WITH AN ID could be deleted, but there is a feature request to preserve these
|
|
51
|
-
warped_geotiff_location = directory + 'w' + id.to_s + '
|
|
51
|
+
warped_geotiff_location = directory + 'w' + id.to_s + '.tif'
|
|
52
52
|
|
|
53
53
|
northmost = nodes_array.first['lat'].to_f
|
|
54
54
|
southmost = nodes_array.first['lat'].to_f
|
|
@@ -222,7 +222,6 @@ class MapKnitterExporter
|
|
|
222
222
|
images.each_with_index do |image, index|
|
|
223
223
|
current += 1
|
|
224
224
|
|
|
225
|
-
## TODO: refactor to generate static status file:
|
|
226
225
|
export.status = 'warping '+current.to_s+' of '+images.length.to_s
|
|
227
226
|
puts 'warping '+current.to_s+' of '+images.length.to_s
|
|
228
227
|
export.save
|
|
@@ -250,20 +249,22 @@ class MapKnitterExporter
|
|
|
250
249
|
# generate a tiff from all warpable images in this set
|
|
251
250
|
def self.generate_composite_tiff(coords, origin, warpables, id, ordered)
|
|
252
251
|
directory = "public/warps/#{id}/"
|
|
253
|
-
composite_location = directory + id.to_s + '
|
|
252
|
+
composite_location = directory + id.to_s + '.tif'
|
|
254
253
|
geotiffs = ''
|
|
255
254
|
minlat = nil
|
|
256
255
|
minlon = nil
|
|
257
256
|
maxlat = nil
|
|
258
257
|
maxlon = nil
|
|
259
|
-
warpables.
|
|
258
|
+
warpables.each_with_index do |warpable, i|
|
|
260
259
|
warpable['nodes'].each do |n|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
260
|
+
puts "warpable: ", n['id'], i, n['lat'], n['lon']
|
|
261
|
+
minlat = n['lat'].to_f if minlat == nil || n['lat'].to_f < minlat
|
|
262
|
+
minlon = n['lon'].to_f if minlon == nil || n['lon'].to_f < minlon
|
|
263
|
+
maxlat = n['lat'].to_f if maxlat == nil || n['lat'].to_f > maxlat
|
|
264
|
+
maxlon = n['lon'].to_f if maxlon == nil || n['lon'].to_f > maxlon
|
|
265
265
|
end
|
|
266
266
|
end
|
|
267
|
+
puts "minlat #{minlat}, minlon #{minlon}, maxlat #{maxlat}, maxlon #{maxlon}"
|
|
267
268
|
first = true
|
|
268
269
|
if ordered != true && warpables.first.keys.include?('poly_area')
|
|
269
270
|
# sort by area; this would be overridden by a provided order
|
|
@@ -271,12 +272,12 @@ class MapKnitterExporter
|
|
|
271
272
|
end
|
|
272
273
|
warpables.each do |warpable|
|
|
273
274
|
wid = "w" + warpable['id'].to_s
|
|
274
|
-
geotiffs += ' '+directory+wid+'
|
|
275
|
+
geotiffs += ' '+directory+wid+'.tif'
|
|
275
276
|
if first
|
|
276
|
-
gdalwarp = "gdalwarp -s_srs EPSG:3857 -te #{minlon} #{minlat} #{maxlon} #{maxlat} #{directory}#{wid}
|
|
277
|
+
gdalwarp = "gdalwarp -s_srs EPSG:3857 -te #{minlon} #{minlat} #{maxlon} #{maxlat} #{directory}#{wid}.tif #{directory}#{id}.tif"
|
|
277
278
|
first = false
|
|
278
279
|
else
|
|
279
|
-
gdalwarp = "gdalwarp #{directory}#{wid}
|
|
280
|
+
gdalwarp = "gdalwarp #{directory}#{wid}.tif #{directory}#{id}.tif"
|
|
280
281
|
end
|
|
281
282
|
puts gdalwarp
|
|
282
283
|
system(self.ulimit+gdalwarp)
|
|
@@ -288,7 +289,7 @@ class MapKnitterExporter
|
|
|
288
289
|
def self.generate_tiles(key, id)
|
|
289
290
|
key = "AIzaSyAOLUQngEmJv0_zcG1xkGq-CXIPpLQY8iQ" if key == "" # ugh, let's clean this up!
|
|
290
291
|
key = key || "AIzaSyAOLUQngEmJv0_zcG1xkGq-CXIPpLQY8iQ"
|
|
291
|
-
gdal2tiles = "gdal2tiles.py -k --s_srs EPSG:3857 -t #{id} -g #{key} public/warps/#{id}/#{id}
|
|
292
|
+
gdal2tiles = "gdal2tiles.py -k --s_srs EPSG:3857 -t #{id} -g #{key} public/warps/#{id}/#{id}.tif public/tms/#{id}/"
|
|
292
293
|
puts gdal2tiles
|
|
293
294
|
if system(self.ulimit+gdal2tiles)
|
|
294
295
|
"public/tms/#{id}/"
|
|
@@ -311,7 +312,7 @@ class MapKnitterExporter
|
|
|
311
312
|
|
|
312
313
|
# generates a tileset at public/tms/<id>/
|
|
313
314
|
def self.generate_jpg(id)
|
|
314
|
-
imageMagick = "convert -background white -flatten public/warps/#{id}/#{id}
|
|
315
|
+
imageMagick = "convert -background white -flatten public/warps/#{id}/#{id}.tif public/warps/#{id}/#{id}.jpg"
|
|
315
316
|
if system(self.ulimit+imageMagick)
|
|
316
317
|
"public/warps/#{id}/#{id}.jpg"
|
|
317
318
|
else
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mapknitter-exporter
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jeffrey Warren
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-
|
|
11
|
+
date: 2019-05-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: The GDAL/ImageMagick-based exporter system from MapKnitter
|
|
14
14
|
email: jeff@unterbahn.com
|