Help with nswtopo v2.0.0

For all high tech electronic equipment including GPS, PLB, chargers, phones, computers, software. Discussion of simple electrical devices such as torches, belongs in the main 'Equipment' forum.

Help with nswtopo v2.0.0

Postby felixthecat » Fri 14 Aug, 2020 2:17 pm

Hi, I'm getting a little frustrated getting this working on my Windows machine. I might have to see if my dusty *nix box turns on...

Anyway, I was wondering if anyone could help... I have used the old version in the past, but wanted to play with the new version...
https://github.com/mholling/nswtopo

I believe I have the prerequisites installed:
Code: Select all
ruby --version
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x64-mingw32]


Code: Select all
identify -version
Version: ImageMagick 7.0.10-27 Q16 x64 2020-08-10 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2018 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 192628806
Features: Cipher DPC HDRI Modules OpenCL OpenMP(2.0)
Delegates (built-in): bzlib cairo flif freetype gslib heic jng jp2 jpeg lcms lqr lzma openexr pangocairo png ps raw rsvg tiff webp xml zlib


Code: Select all
gdalinfo --version
GDAL 3.0.4, released 2020/01/28



I've installed nswtopo and nswtopo-layers using gem:
Code: Select all
nswtopo -v
2.0.0


I can't use a bounds.kml file. I think this is because I made it using GE (since it mentions pushpin):
Code: Select all
nswtopo init -b bounds.kml map.tgz
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo.rb:48: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/map.rb:18: warning: The called method `init' is defined here
nswtopo: [BUG] Unexpected node test: <:predicate>: <[[:eq, [:attribute, :qname, "", "id"], [:literal, "m_ylw-pushpin"]]]>


I could successfully create a map by defining coordinates instead using --coords... but then I can't even add the nsw/topographic map layer :(

Code: Select all
nswtopo init --coords 150.0,-32.5,150.1,-32.6 map.tgz
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo.rb:48: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/map.rb:18: warning: The called method `init' is defined here
scale:      1:25000
dimensions: 375mm × 443mm
extent:     9.4km × 11.1km
area:       104.2km²
rotation:   0.0°
nswtopo: map saved


Code: Select all
nswtopo add map.tgz nsw/topographic
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo.rb:129: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/map.rb:177: warning: The called method `add' is defined here
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/layer/feature.rb:16: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/layer/feature.rb:16: warning: The called method is defined here
nsw.topographic.plantation-horticulture: retrieving featuresC:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/gis/arcgis_server/connection.rb:44: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/gis/arcgis_server/connection.rb:20: warning: The called method `get' is defined here
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/gis/arcgis_server.rb:85: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/map.rb:116: warning: The called method `bounding_box' is defined here
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/gis/arcgis_server.rb:89: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/gis/arcgis_server/connection.rb:43: warning: The called method `get_json' is defined here
nsw.topographic.plantation-horticulture: retrieved 0 of 3 featuresC:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/layer/vector.rb:10: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/map.rb:116: warning: The called method `bounding_box' is defined here
Traceback (most recent call last):
        28: from C:/Ruby27-x64/bin/nswtopo:23:in `<main>'
        27: from C:/Ruby27-x64/bin/nswtopo:23:in `load'
        26: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/bin/nswtopo:409:in `<top (required)>'
        25: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/archive.rb:58:in `open'
        24: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/archive.rb:58:in `open'
        23: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/archive.rb:65:in `block in open'
        22: from C:/Ruby27-x64/lib/ruby/2.7.0/rubygems/package/tar_reader.rb:29:in `new'
        21: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/archive.rb:66:in `block (2 levels) in open'
        20: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/archive.rb:66:in `tap'
        19: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/bin/nswtopo:418:in `block in <top (required)>'
        18: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo.rb:123:in `add'
        17: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo.rb:123:in `tap'
        16: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo.rb:129:in `block in add'
        15: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/map.rb:185:in `add'
        14: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/map.rb:185:in `inject'
        13: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/map.rb:185:in `each'
        12: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/map.rb:188:in `block in add'
        11: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/layer/vector.rb:10:in `create'
        10: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/gis/geojson/collection.rb:82:in `clip!'
         9: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/gis/geojson/collection.rb:82:in `map!'
         8: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/gis/geojson/collection.rb:83:in `block in clip!'
         7: from C:/Ruby27-x64/lib/ruby/2.7.0/forwardable.rb:235:in `clip'
         6: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/gis/geojson/multi_polygon.rb:7:in `clip'
         5: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/gis/geojson/multi_polygon.rb:7:in `inject'
         4: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/gis/geojson/multi_polygon.rb:7:in `each'
         3: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/gis/geojson/multi_polygon.rb:9:in `block in clip'
         2: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/geometry/vector_sequence.rb:3:in `perps'
         1: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/geometry/vector_sequence.rb:3:in `map'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/geometry/vector.rb:69:in `perp': undefined method `-@' for [8883.882506364629, -5412.264536419569]:Array (NoMethodError)


Any help is very welcome! Thanks :)
felixthecat
Nothofagus gunnii
Nothofagus gunnii
 
Posts: 31
Joined: Wed 08 Apr, 2015 2:40 pm
ASSOCIATED ORGANISATIONS: SUBW, CWBC, SUSS
Region: New South Wales

Re: Help with nswtopo v2.0.0

Postby Huntsman247 » Fri 14 Aug, 2020 7:43 pm

Not sure about that one but have you tried Mapc2mapc?
It works well on windows and is easy enough to use. License for it is super cheap.
https://www.the-thorns.org.uk/mapping/help/begin.html
User avatar
Huntsman247
Phyllocladus aspleniifolius
Phyllocladus aspleniifolius
 
Posts: 520
Joined: Wed 22 Mar, 2017 10:07 pm
Region: New South Wales
Gender: Male

Re: Help with nswtopo v2.0.0

Postby michael_p » Sat 15 Aug, 2020 11:24 am

I'm no expert so here is a guess. Try using Ruby 2.5 instead of 2.7. The script was written for 2.5 and there could be something that is version specific in the Xpath parsing of the KML.

Also, could you post the kml data?

I used yml on Ubuntu to create maps with this script. After a few PEBKAC errors it worked really well.

Michael.
One foot in front of the other.
User avatar
michael_p
Athrotaxis selaginoides
Athrotaxis selaginoides
 
Posts: 1238
Joined: Sun 15 Nov, 2009 6:58 pm
Location: Macarthur Region of Sydney.
Region: New South Wales
Gender: Male

Re: Help with nswtopo v2.0.0

Postby felixthecat » Sun 16 Aug, 2020 8:24 pm

Huntsman247 wrote:Not sure about that one but have you tried Mapc2mapc?
It works well on windows and is easy enough to use. License for it is super cheap.
https://www.the-thorns.org.uk/mapping/help/begin.html


I haven't tried this. Thanks for the suggestion...
From my very brief look, it seems to convert existing maps to different formats... not really create maps... I'll have a better look in the future. Need to prep for a trip tomorrow...
felixthecat
Nothofagus gunnii
Nothofagus gunnii
 
Posts: 31
Joined: Wed 08 Apr, 2015 2:40 pm
ASSOCIATED ORGANISATIONS: SUBW, CWBC, SUSS
Region: New South Wales

Re: Help with nswtopo v2.0.0

Postby felixthecat » Sun 16 Aug, 2020 8:29 pm

michael_p wrote:I'm no expert so here is a guess. Try using Ruby 2.5 instead of 2.7. The script was written for 2.5 and there could be something that is version specific in the Xpath parsing of the KML.

Also, could you post the kml data?

I used yml on Ubuntu to create maps with this script. After a few PEBKAC errors it worked really well.

Michael.


Thanks for the reply Michael...

I tried the following:
Code: Select all
gem update --system 2.5

Code: Select all
ruby --version
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x64-mingw32]


Its still crashing (in the same place I think). It tries to download the nsw.topographic.contours... gets 500 of 579 before it seems to crash:
Code: Select all
C:\Users\User1\Desktop>nswtopo add map.tgz nsw/topographic
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo.rb:129: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/map.rb:177: warning: The called method `add' is defined here
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/layer/feature.rb:16: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/layer/feature.rb:16: warning: The called method is defined here
nsw.topographic.plantation-horticulture: retrieving featuresC:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/gis/arcgis_server/connection.rb:44: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/gis/arcgis_server/connection.rb:20: warning: The called method `get' is defined here
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/gis/arcgis_server.rb:85: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/map.rb:116: warning: The called method `bounding_box' is defined here
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/gis/arcgis_server.rb:89: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/gis/arcgis_server/connection.rb:43: warning: The called method `get_json' is defined here
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/layer/vector.rb:10: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/map.rb:116: warning: The called method `bounding_box' is defined here
nswtopo: empty layer: nsw.topographic.plantation-horticulture
nswtopo: empty layer: nsw.topographic.urban-areas
nsw.topographic.contours: retrieved 500 of 579 featuresTraceback (most recent call last):
        25: from C:/Ruby27-x64/bin/nswtopo:26:in `<main>'
        24: from C:/Ruby27-x64/bin/nswtopo:26:in `load'
        23: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/bin/nswtopo:409:in `<top (required)>'
        22: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/archive.rb:58:in `open'
        21: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/archive.rb:58:in `open'
        20: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/archive.rb:65:in `block in open'
        19: from C:/Ruby27-x64/lib/ruby/site_ruby/2.7.0/rubygems/package/tar_reader.rb:28:in `new'
        18: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/archive.rb:66:in `block (2 levels) in open'
        17: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/archive.rb:66:in `tap'
        16: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/bin/nswtopo:418:in `block in <top (required)>'
        15: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo.rb:123:in `add'
        14: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo.rb:123:in `tap'
        13: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo.rb:129:in `block in add'
        12: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/map.rb:185:in `add'
        11: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/map.rb:185:in `inject'
        10: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/map.rb:185:in `each'
         9: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/map.rb:188:in `block in add'
         8: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/layer/vector.rb:10:in `create'
         7: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/gis/geojson/collection.rb:82:in `clip!'
         6: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/gis/geojson/collection.rb:82:in `map!'
         5: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/gis/geojson/collection.rb:83:in `block in clip!'
         4: from C:/Ruby27-x64/lib/ruby/2.7.0/forwardable.rb:235:in `clip'
         3: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/gis/geojson/multi_line_string.rb:7:in `clip'
         2: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/geometry/vector_sequence.rb:3:in `perps'
         1: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/geometry/vector_sequence.rb:3:in `map'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/nswtopo-2.0.0/lib/nswtopo/geometry/vector.rb:69:in `perp': undefined method `-@' for [4721.235002887568, -5569.8238747219075]:Array (NoMethodError)


I'll try uploading the kml in a moment...
felixthecat
Nothofagus gunnii
Nothofagus gunnii
 
Posts: 31
Joined: Wed 08 Apr, 2015 2:40 pm
ASSOCIATED ORGANISATIONS: SUBW, CWBC, SUSS
Region: New South Wales

Re: Help with nswtopo v2.0.0

Postby felixthecat » Sun 16 Aug, 2020 8:30 pm

felixthecat wrote:I tried the following:
Code: Select all
gem update --system 2.5

Code: Select all
ruby --version
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x64-mingw32]



Silly me... it didn't seem to downgrade the Ruby version at all... just a moment...
felixthecat
Nothofagus gunnii
Nothofagus gunnii
 
Posts: 31
Joined: Wed 08 Apr, 2015 2:40 pm
ASSOCIATED ORGANISATIONS: SUBW, CWBC, SUSS
Region: New South Wales

Re: Help with nswtopo v2.0.0

Postby felixthecat » Sun 16 Aug, 2020 9:25 pm

michael_p wrote:I'm no expert so here is a guess. Try using Ruby 2.5 instead of 2.7. The script was written for 2.5 and there could be something that is version specific in the Xpath parsing of the KML.

Also, could you post the kml data?

I used yml on Ubuntu to create maps with this script. After a few PEBKAC errors it worked really well.

Michael.



Okay... I uninstalled Ruby and reinstalled the older version from here: https://rubyinstaller.org/downloads/

Looks better now:
Code: Select all
ruby --version
ruby 2.5.8p224 (2020-03-31 revision 67882) [x64-mingw32]


I then need to reinstall nswtopo, etc.

Its working now! Thanks Michael!
Even the KML! As you guessed it was just a Xpath parsing issue with the new version of Ruby.
Thanks again :)
felixthecat
Nothofagus gunnii
Nothofagus gunnii
 
Posts: 31
Joined: Wed 08 Apr, 2015 2:40 pm
ASSOCIATED ORGANISATIONS: SUBW, CWBC, SUSS
Region: New South Wales

Re: Help with nswtopo v2.0.0

Postby michael_p » Mon 17 Aug, 2020 10:23 am

So glad that worked. Excellent result. :D :D :D :D
One foot in front of the other.
User avatar
michael_p
Athrotaxis selaginoides
Athrotaxis selaginoides
 
Posts: 1238
Joined: Sun 15 Nov, 2009 6:58 pm
Location: Macarthur Region of Sydney.
Region: New South Wales
Gender: Male


Return to Techno-Babble

Who is online

Users browsing this forum: No registered users and 8 guests