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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mapknitterExporter.rb +14 -13
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0dd600a2ddcdd7d435cb9a9a5c20886e86bc1083
4
- data.tar.gz: 7bfaa441df599a77380aec9b85b4b4a3e8bbc16f
3
+ metadata.gz: 89a5b76f3d5867d7ec0af78db1e7df96388a990d
4
+ data.tar.gz: fa3232bcb5378d0cb2eb7e189b617e7cc1005474
5
5
  SHA512:
6
- metadata.gz: c7143d0afbc78a3f3324978d4088823c301d4ffc813c3f5a7820452d5541bfb36e9d4382f605193ef7fd5ed6d6bd66bea54d8e1ef6c9fc22c59ffd8a99444362
7
- data.tar.gz: 38b1e54c611e05b3560afcfbc7241c7e59c92f0a185c278885695ea18f540e04eda52221f9572952268cc3671cc268e926878e678608f86a5a8bfac18c7904aa
6
+ metadata.gz: be7aaf40565549c1332f789e2af510dd8e00fbcbccbc19917a6420a1a4c914651dacb7ee0670ac71a24f4e3f13b58f85e56664b4841ab3cfcf9107f647ca5e3a
7
+ data.tar.gz: a270c38522ca390434e7e3718cb4c7f7fe4a3edba61200300c386d909e13ea1181f86c699551fbe7cd458de05ea0f69a7cf1ef83cfcb51341d92e1e4a6c5210c
@@ -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 + '-geo.tif'
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 + '-geo.tif'
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.each do |warpable|
258
+ warpables.each_with_index do |warpable, i|
260
259
  warpable['nodes'].each do |n|
261
- minlat = n['lat'] if minlat == nil || n['lat'] < minlat
262
- minlon = n['lon'] if minlon == nil || n['lon'] < minlon
263
- maxlat = n['lat'] if maxlat == nil || n['lat'] > maxlat
264
- maxlon = n['lon'] if maxlon == nil || n['lon'] > maxlon
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+'-geo.tif'
275
+ geotiffs += ' '+directory+wid+'.tif'
275
276
  if first
276
- gdalwarp = "gdalwarp -s_srs EPSG:3857 -te #{minlon} #{minlat} #{maxlon} #{maxlat} #{directory}#{wid}-geo.tif #{directory}#{id}-geo.tif"
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}-geo.tif #{directory}#{id}-geo.tif"
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}-geo.tif public/tms/#{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}-geo.tif public/warps/#{id}/#{id}.jpg"
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.3
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-04-30 00:00:00.000000000 Z
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