JOSM/Plugins/Scanaerial

From OpenStreetMap Wiki
< JOSM‎ | Plugins(Redirected from Scanaerial)
Jump to: navigation, search
Available languages — JOSM/Plugins/Scanaerial
· Afrikaans · Alemannisch · aragonés · asturianu · azərbaycanca · Bahasa Indonesia · Bahasa Melayu · Bân-lâm-gú · Basa Jawa · Basa Sunda · Baso Minangkabau · bosanski · brezhoneg · català · čeština · corsu · dansk · Deutsch · eesti · English · español · Esperanto · estremeñu · euskara · français · Frysk · Gaeilge · Gàidhlig · galego · Hausa · hrvatski · Igbo · interlingua · Interlingue · isiXhosa · isiZulu · íslenska · italiano · Kiswahili · Kreyòl ayisyen · kréyòl gwadloupéyen · Kurdî · latviešu · Lëtzebuergesch · lietuvių · magyar · Malagasy · Malti · Nederlands · Nedersaksies · norsk bokmål · norsk nynorsk · occitan · Oromoo · oʻzbekcha/ўзбекча · Plattdüütsch · polski · português · română · shqip · slovenčina · slovenščina · Soomaaliga · suomi · svenska · Tagalog · Tiếng Việt · Türkçe · Vahcuengh · vèneto · Wolof · Yorùbá · Zazaki · српски / srpski · беларуская · български · қазақша · македонски · монгол · русский · тоҷикӣ · українська · Ελληνικά · Հայերեն · ქართული · नेपाली · मराठी · हिन्दी · भोजपुरी · অসমীয়া · বাংলা · ਪੰਜਾਬੀ · ગુજરાતી · ଓଡ଼ିଆ · தமிழ் · తెలుగు · ಕನ್ನಡ · മലയാളം · සිංහල · བོད་ཡིག · ไทย · မြန်မာဘာသာ · ລາວ · ភាសាខ្មែរ · ⵜⴰⵎⴰⵣⵉⵖⵜ ⵜⴰⵏⴰⵡⴰⵢⵜ‎ · አማርኛ · 한국어 · 日本語 · 中文(简体)‎ · 中文(繁體)‎ · 吴语 · 粵語 · ייִדיש · עברית · اردو · العربية · پښتو · سنڌي · فارسی · ދިވެހިބަސް

General

JOSM screenshot showing unmapped tundra with Bing Imagery
JOSM screenshot showing tundra with mapped lakes and Bing Imagery
JOSM screenshot showing tundra with mapped lakes, data only

Scanaerial is a package with python code to scan aerial pictures.

Requirements

  • JOSM (current version)
  • Ext_tools plug-in for JOSM
  • Python & needed libraries (run library_check.py to find out if a library is missing)
    • Python Image Library (in Gentoo: dev-python/imaging). This is only available in Python 2.7 and is not currently available in the newer 3+ versions.
    • Python Projection Library (in Gentoo: dev-python/pyproj)
  • Current Scanaerial-Script

Setup

Windows

  • Unzip the archive and put it in a directory you like (e.g. C:\scanaerial\)
  • Install Python, version 2.7 recommended (in our example installed to C:\python27\)

python-2.7.10.msifor Win32
or
python-2.7.10.amd64.msi for Win64

('pil' is already there.)

pyproj-1.9.5-cp27-none-win32.whl for Win32
or
pyproj-1.9.5-cp27-none-win_amd64.whl for Win64

  • Install Ext_tools-Plugin in JOSM (more information on JOSM/Plugins#Installation) & Restart JOSM
  • In JOSM press F12 and go to Ext_tools configuration
  • Add a new tool by clicking the button saying so. Give the tool a good name (scanaerial would be an idea) and paste this as commandline:
C:\python27\python.exe C:\scanaerial\scanaerial.py {lat} {lon} {TZoom}

or if there is a space in the name of the directory (e.g. C:\scan aerial\)

C:\python27\python.exe "C:\SCANAE~1\scanaerial.py" {lat} {lon} {TZoom}

Use

C:\python27\python.exe C:\scanaerial\scanaerial.py {lat} {lon}

without {TZoom} to always use Config-File setting fixedzoomlevel. It will create a new menu item in the tools menu.


Windows 10 x64

(for dummies)


  • create temporary TEMP folder (e.g. C:\TEMP )
  • go to TEMP folder (C:\TEMP )




  • Download scanaerial-master.zip and save it to TEMP
  • UnZip the archive to TEMP as scanaerial
    • if you do not have unzip - use WinRAR (Download/Save/Install)
  • move "scanaerial" to any folder that you like (e.g. C:\josm\scanaerial )


  • Download "Python installer" version 2.7.xх "python-2.7.xx.msi" (Yellow button on the top) from www.python.org/downloads and save it to TEMP
  • Install Python (in our example it is installed to C:\josm\python2 )



  • Download "Microsoft Visual C++ Compiler for Python 2.7" aka.ms/vcpython27 (83Mb) and save it to TEMP
  • Install "VCForPython27.msi"
    • Installing and Uninstalling. The compiler package is installed only for the current user and does not require administrative privileges by default. To install It for all users of a machine, execute msiexec /i <path to MSI> ALLUSERS=1 using Command Prompt.
    • To remove or repair the compiler package, locate the entry in Programs and Features and select Remove or Repair.
    • Using with Python distribution tools
    • Python package developers should download and use this compiler to produce binary wheels for their Python packages to upload to PyPI. Installing the wheel package, updating to setuptools 6.0 or later, and adding setup.py bdist_wheel upload to your build process will produce the correct files (remember to do this for both 32-bit and 64-bit versions).
    • If a Python package you are installing does not have a wheel, you can install this compiler package on your own machine. Once the compiler is installed and you have updated to setuptools 6.0 or later, you can use pip install to build and install the Python package. If you are managing multiple machines and need to install the Python package on all of them, you should install the wheel package and use pip wheel to produce a wheel that can be installed on machines without requiring this package.


  • REBOOT YOU PC (reboot = no many error is next time)


  • Open in Windows FileExplorer this folder: C:\josm\python2\Scripts\
  • run C:\josm\python2\Scripts\easy_install-2.7.exe
  • run C:\josm\python2\Scripts\easy_install.exe
  • run C:\josm\python2\Scripts\pip2.7.exe
  • run C:\josm\python2\Scripts\pip2.exe
  • run C:\josm\python2\Scripts\pip.exe
  • press [Win+R]
  • powershell
  • cd C:\josm\python2\Scripts\
  • pip install --upgrade setuptools
    • IF "Successfully installed setuptools-xx.x.0" next, ELSE "search error"
    • IF "Requirement already up-to-date: setuptools in c:\josm\python2\lib\site-packages" next, ELSE "search error"
      • IF ERROR = pip : The term 'pip' is not recognized as the name of a cmdlet, function, script file, or operable program.
        • Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
        • At line:1 char:1
        • + pip install --upgrade setuptools --user python
        • + velmyshanovnyi (talk)
        • + CategoryInfo  : ObjectNotFound: (pip:String) [], CommandNotFoundException
        • + FullyQualifiedErrorId : CommandNotFoundException
      • FIX THIS ERROR =
        • Reboot you pc
        • Reinstall Python, and repeat all next step after install Python
  • pip install --upgrade pyproj
    • IF "Successfully installed pyproj-1.9.xx.xx" next, ELSE "search error"
    • FOR manualy install use site PyProj - an interface to the PROJ.4 library for cartographic transformations "pyproj‑1.9.5.1‑cp27‑cp27m‑win_amd64.whl"
      • IF ERROR = mt.exe
      • FIX THIS ERROR =
        • ReInstall (Repair) "VCForPython27.msi" from TEMP folder
        • Reboot you pc
        • repeat all next step after RUN powershell


  • close powershell



  • see next text this manual.....

Linux

  • Unzip the contents of the downloaded archive to the JOSM Plugin directory. Put it to: ~/.josm/plugins/ext_tools/scanaerial
  • Install Python + needed libraries:
    • Fedora: yum install pyproj python-pillow
  • Install Ext_tools-Plugin in JOSM (more information on JOSM/Plugins#Installation) & Restart JOSM
  • In JOSM press F12 and go to Ext_tools configuration
  • Add a new tool by clicking the button saying so. Give the tool a good name (scanaerial would be an idea) and paste this as commandline:
/home/<username>/.josm/plugins/ext_tools/scanaerial/scanaerial.py {lat} {lon} {TZoom}

It will create a new menu item in the tools menu. (NB: Syntax may change soon. Due to a bug in Ext_tools you can not write “~” instead of “home”)

Using Scanaerial

  • To invoke scanaerial press ctrl+k or select the new menu item. Now point the cursor on the area you want to trace and left-click.
  • For best result you may finetune the values in scanaerial.cfg

Multiple configurations

It is possible to configure Scanaerial to work with several distinct config files. To do so create a separate tool with distinct names for each configuration. The name of the configuration file is passed as the fourth argument to scanaerial.py

Example commandline:

/home/<username>/.josm/plugins/ext_tools/scanaerial/scanaerial.py {lat} {lon} {TZoom} myconfig1.cfg

Finetuning Config-File

Key Default value Function
fixedzoomlevel 11 use this zoomlevel, if Ext_tools did not tell via TZoom
server_api bing access method of map server: wms, tms or bing
server_name Bing name of the map server (only for the tag string)
server_url http://dev.virtualearth.net/... half-link for WMS, JOSM-like address for TMS
empty_tile_bytes 1033 size of empty tile (in bytes) for current map server
empty_tile_checksum -332268601 checksum of empty tile file (algorithm: CRC32)
projection EPSG:3857 projection that is used on the map server
tile_sizex 256 leave it to 256 unless you know what you do
tile_sizey 256 leave it to 256 unless you know what you do
douglas_peucker_epsilon 0.60 maximum roughness for smoothening the line
deactivate_simplifying 0 deactivate Douglas-Peucker algorithm (only for debugging)
colour_str 30 colour sensitivity (depends on contrast of images)
maxfilter_setting 3 median filter size (noise reduction strength)
size_limit 400 maximum size of produced object

Available servers

server_api = wms

server_name = Landsat
server_url = http://irs.gis-lab.info/?layers=landsat&

server_api = wms

server_name = OSM
server_url = http://ows.terrestris.de/osm/service?FORMAT=image/jpeg&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&LAYERS=OSM-WMS&STYLES=&

server_api = tms

server_name = MapBox
server_url = http://{switch:a,b,c}.tiles.mapbox.com/v4/openstreetmap.map-inh7ifmo/{zoom}/{x}/{y}.png?access_token=pk.eyJ1Ijoib3BlbnN0cmVldG1hcCIsImEiOiJncjlmd0t3In0.DmZsIeOW-3x-C5eX-wAqTw
empty_tile_bytes = 1882
empty_tile_checksum = -1893505042

server_api = tms

server_name = MapQuest
server_url = http://oatile{switch:1,2,3,4}.mqcdn.com/tiles/1.0.0/sat/{zoom}/{x}/{y}.png
empty_tile_bytes = 2935
empty_tile_checksum = 839257317

server_api = bing

server_name = Bing
server_url = http://dev.virtualearth.net/REST/v1/Imagery/Metadata/Aerial?include=ImageryProviders&output=xml&key=Arzdiw4nlOJzRwOz__qailc8NiR31Tt51dN2D7cm57NrnceZnCpgOkmJhNpGoppU
empty_tile_bytes = 1033
empty_tile_checksum = -332268601

server_api = tms

server_name = DigitalGlobe
server_url = http://{switch:a,b,c}.tiles.mapbox.com/v4/digitalglobe.0a8e44ba/{zoom}/{x}/{y}.png?access_token=pk.eyJ1IjoiZGlnaXRhbGdsb2JlIiwiYSI6ImNqMmFxcGJ2MjAwOHEzMm9nZmF2c3luZWkifQ.HsF19zOlj8PeOxo5BhNqyQ

server_api = tms

server_name = ESRIWorld
server_url = https://{switch:services,server}.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/tile/{zoom}/{y}/{x}
empty_tile_bytes = 1882
empty_tile_checksum = -1893505042

Fan stuff

if you like scanaerial you can show others that you use it by putting

[[Category:Scanaerial User]]

in your Userpage.

See Also