Anaconda install with OSGeo4W

I was coming across some errors when installing Anaconda, Miniconda specifically.

https://conda.io/miniconda.html

I think part of the reason is I have quite a few installs of Python due to OSGeo4W.

My error:

Fatal Python error: Py_Initialize: unable to load the file system codec

ModuleNotFoundError: No module named 'encodings'



Current thread 0x00002554 (most recent call first):

The solution:

Update the activate.bat file that is called when launching from the start menu. For me located in:

C:\ProgramData\Anaconda\Scripts

We need to add in the following to clear out and reset the python environment before launching anaconda:

@SET PYTHONPATH=

@SET PYTHONHOME=C:\ProgramData\Anaconda

@PATH C:\ProgramData\Anaconda;C:\ProgramData\Anaconda\Scripts;%PATH%

So, editing the file from:

@REM Test first character and last character of %1 to see if first character is a "

@REM   but the last character isn't.

@REM This was a bug as described in https://github.com/ContinuumIO/menuinst/issues/60

@REM When Anaconda Prompt has the form

@REM   %windir%\system32\cmd.exe "/K" "C:\Users\builder\Miniconda3\Scripts\activate.bat" "C:\Users\builder\Miniconda3"

@REM Rather than the correct

@REM    %windir%\system32\cmd.exe /K ""C:\Users\builder\Miniconda3\Scripts\activate.bat" "C:\Users\builder\Miniconda3""

@REM this solution taken from https://stackoverflow.com/a/31359867

@set "_args1=%1"

@set _args1_first=%_args1:~0,1%

@set _args1_last=%_args1:~-1%

@set _args1_first=%_args1_first:"=+%

@set _args1_last=%_args1_last:"=+%

@set _args1=





@if "%_args1_first%"=="+" if NOT "%_args1_last%"=="+" (

    @CALL "%~dp0..\Library\bin\conda.bat" activate

    @GOTO :End

)



@CALL "%~dp0..\Library\bin\conda.bat" activate %*



:End

@set _args1_first=

@set _args1_last=

To:

@REM Test first character and last character of %1 to see if first character is a "

@REM   but the last character isn't.

@REM This was a bug as described in https://github.com/ContinuumIO/menuinst/issues/60

@REM When Anaconda Prompt has the form

@REM   %windir%\system32\cmd.exe "/K" "C:\Users\builder\Miniconda3\Scripts\activate.bat" "C:\Users\builder\Miniconda3"

@REM Rather than the correct

@REM    %windir%\system32\cmd.exe /K ""C:\Users\builder\Miniconda3\Scripts\activate.bat" "C:\Users\builder\Miniconda3""

@REM this solution taken from https://stackoverflow.com/a/31359867

@set "_args1=%1"

@set _args1_first=%_args1:~0,1%

@set _args1_last=%_args1:~-1%

@set _args1_first=%_args1_first:"=+%

@set _args1_last=%_args1_last:"=+%

@set _args1=



@SET PYTHONPATH=

@SET PYTHONHOME=C:\ProgramData\Anaconda

@PATH C:\ProgramData\Anaconda;C:\ProgramData\Anaconda\Scripts;%PATH%



@if "%_args1_first%"=="+" if NOT "%_args1_last%"=="+" (

    @CALL "%~dp0..\Library\bin\conda.bat" activate

    @GOTO :End

)



@CALL "%~dp0..\Library\bin\conda.bat" activate %*



:End

@set _args1_first=

@set _args1_last=

Updating the paths as required.

This just clears out the python and windows environmental variables before launching, similar to what OSGeo4W does.

QGIS OpenStreetMap Scales

Save as a text file ending in .xml like qgis_scales.xml

These are the scales OpenStreetMap tiles are rendered in for 96 dpi, so the map will look sharp on most monitors. These are the scales for the zoom levels.

The xml file can then be loaded into the project from:

Project> Project Properties…> General> Project scales

<qgsScales version="1.0">
    <scale value="1:554678932"/>
    <scale value="1:277339466"/>
    <scale value="1:138669733"/>
    <scale value="1:69334866"/>
    <scale value="1:34667433"/>
    <scale value="1:17333716"/>
    <scale value="1:8666858"/>
    <scale value="1:4333429"/>
    <scale value="1:2166714"/>
    <scale value="1:1083357"/>
    <scale value="1:541678"/>
    <scale value="1:270839"/>
    <scale value="1:135419"/>
    <scale value="1:67709"/>
    <scale value="1:33854"/>
    <scale value="1:16927"/>
    <scale value="1:8463"/>
    <scale value="1:4231"/>
    <scale value="1:2115"/>
</qgsScales>

Example:

1,000,000 (QGIS default):

1,083,357 (OSM wiki):

1,155,584 (From: 3liz):

Scales from:
OSM wiki

Zoom scales.