Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Folium doesn't package as expected when compiling to an executable #1081

Closed
nathan3leaf opened this issue Mar 6, 2019 · 32 comments
Closed
Labels
question The issue contains a question about how to do something

Comments

@nathan3leaf
Copy link

Please add a code sample or a nbviewer link, copy-pastable if possible

import folium
from tkinter import *

class UserInterface:
	"""This is just a basic interface to enter coordinates to test the folium functionality"""

	def __init__(self):
		super(UserInterface,self).__init__()
		UserInterface.window = Tk()
		UserInterface.map_name_label = Label(UserInterface.window, text="Enter A Map Name")
		UserInterface.map_name_label.grid(row=0, column=0)
		UserInterface.map_name_text = StringVar()
		UserInterface.map_name_entry = Entry(UserInterface.window, textvariable=UserInterface.map_name_text)
		UserInterface.map_name_entry.grid(row=0, column=1)

		UserInterface.lat1label = Label(UserInterface.window, text="Point 1 Lat:")
		UserInterface.lat1label.grid(row=1, column=0)
		UserInterface.lat1text = StringVar()
		UserInterface.lat1_entry = Entry(UserInterface.window, textvariable=UserInterface.lat1text)
		UserInterface.lat1_entry.grid(row=1, column=1)

		UserInterface.long1label = Label(UserInterface.window, text="Point 1 Long:")
		UserInterface.long1label.grid(row=2, column=0)
		UserInterface.long1text = StringVar()
		UserInterface.lat1_entry = Entry(UserInterface.window, textvariable=UserInterface.long1text)
		UserInterface.lat1_entry.grid(row=2, column=1)

		UserInterface.lat2label = Label(UserInterface.window, text="Point 2 Lat:")
		UserInterface.lat2label.grid(row=3, column=0)
		UserInterface.lat2text = StringVar()
		UserInterface.lat2_entry = Entry(UserInterface.window, textvariable=UserInterface.lat2text)
		UserInterface.lat2_entry.grid(row=3, column=1)

		UserInterface.long2label = Label(UserInterface.window, text="Point 2 Long:")
		UserInterface.long2label.grid(row=4, column=0)
		UserInterface.long2text = StringVar()
		UserInterface.long2_entry = Entry(UserInterface.window, textvariable=UserInterface.long2text)
		UserInterface.long2_entry.grid(row=4, column=1)

		UserInterface.create_map_button = Button(UserInterface.window, text="Get Map", command=UserInterface.get_map, width=20)
		UserInterface.create_map_button.grid(row=5, columnspan=2)
		UserInterface.map_status = Label(UserInterface.window, text="")
		UserInterface.map_status.grid(row=6, column=0)
		UserInterface.window.mainloop()

	def get_map():
		UserInterface.map_status = Label(UserInterface.window, text="Getting map...")
		UserInterface.map_status.grid(row=6, column=0)
		centerpoint = [float(UserInterface.lat1text.get()), float(UserInterface.long1text.get())]
		marker = [float(UserInterface.lat2text.get()),float(UserInterface.long2text.get())]
		MapProgram.mapping.create_map(centerpoint=centerpoint, marker=marker)

class FoliumTest:
	"""This is just a basic class declaration to test the compiling process of folium when using Pyinstaller"""
	
	def __init__(self):
		super(FoliumTest,self).__init__()

	def create_map(self, centerpoint, marker):
		map_image = folium.Map(location=[centerpoint[0], centerpoint[1]], zoom_start=14, tiles='OpenStreetMap')
		centerpoint_icon_url = "http://maps.google.com/mapfiles/kml/shapes/star.png"
		centerpoint_icon = folium.features.CustomIcon(centerpoint_icon_url, icon_size=(70,70))
		folium.Marker([centerpoint[0], centerpoint[1]], icon=centerpoint_icon).add_to(map_image)
		custom_map_icon_url = "http://maps.google.com/mapfiles/kml/shapes/shaded_dot.png"
		custom_map_icon = folium.features.CustomIcon(custom_map_icon_url, icon_size=(50,50))
		folium.Marker([marker[0], marker[1]], icon=custom_map_icon).add_to(map_image)
		map_image.save(outfile=UserInterface.map_name_text.get() + ".html")
		UserInterface.map_status = Label(UserInterface.window, text="Map created!")
		UserInterface.map_status.grid(row=6, column=0)

class MapProgram:
	"""This sets up the interface with the mapping functionality"""

	def __init__(self):
		MapProgram.mapping = FoliumTest()
		UserInterface()
		#Optional Coords to use for testing
		#centerpoint = [37.9969,-121.2919]
		#marker = [38.0132,-121.3671])

def main():
	MapProgram()
	
if __name__ == '__main__':
	main()

Problem description

When attempting to make an exe using pyinstaller, cx_freeze, py2exe etc, the folium module and its dependencies don't seem to get compiled properly so that the program can run successfully. In the process of trying to determine where the core problem resided, I came across unexpected behavior when typing from folium import * which resulted in an error AttributeError: module 'folium' has no attribute 'GeoJsonStyle' This seemed odd to me and I thought possibly why the exe is not being compiled as it would throw the error that _cnames.json could not be found, which makes sense if GeoJsonStyle doesn't exist in the module but perhaps it's supposed to. If I attempt to compile the above program, but comment out folium, the compiled executable runs fine, so I know it's related to folium specifically.

Expected Output

I expected the module to compile and load correctly so that it can be utilized in an executable.

Output of folium.__version__

0.7.0

@ocefpaf
Copy link
Member

ocefpaf commented Mar 6, 2019

I expected the module to compile and load correctly so that it can be utilized in an executable.

I don't know any of those tools and I'm not familiar with the process of creating an exe. All I can say is that, if folium is properly installed, it should work 😬

With that said, if you can provide any details of those tools and its limitations/expectations of a package it would help us debug this. I Google about some of them and it seems that there are a number of limitations!

Closing this b/c folium does not aim to be made into an exe. We can still discuss in this thread to figure out why and, if the solution is simple, implement a fix for it.

@ocefpaf ocefpaf closed this as completed Mar 6, 2019
@nathan3leaf
Copy link
Author

@ocefpaf Ok let's forget the exe issue for now.

Is it problematic that from folium import * would throw an error? And if it is problematic, could that have been caused by something on my end?

@ocefpaf
Copy link
Member

ocefpaf commented Mar 6, 2019

@ocefpaf Ok let's forget the exe issue for now.

OK.

Is it problematic that from folium import * would throw an error?

Problematic? Yes. I could not reproduce that with folium 0.8.0 (latest) I'm guessing that is a bug that was fixed in 0.7.0.

And if it is problematic, could that have been caused by something on my end?

You probably just need an update.

@nathan3leaf
Copy link
Author

Upgraded fine and from folium import * no longer throws an error.

It seems that one of the dependencies of folium is branca, is that correct or am I mistaken? The error that I see when I run my exe refers to a file called _cnames.json which is in the site-packages/branca folder. Could this potentially be a branca issue or is there something about how folium 'talks' to branca that could be an issue? Pardon my understanding of this, I'm still very new to Python and coding and just trying to learn how to properly track down problems that I encounter. I appreciate your help.

@ocefpaf
Copy link
Member

ocefpaf commented Mar 6, 2019

Upgraded fine and from folium import * no longer throws an error.

🎉

It seems that one of the dependencies of folium is branca, is that correct or am I mistaken?

That is correct.

The error that I see when I run my exe refers to a file called _cnames.json which is in the site-packages/branca folder. Could this potentially be a branca issue or is there something about how folium 'talks' to branca that could be an issue?

It is probably a branca issue but we need to understand what these exe creators "want" to fix it.

Pardon my understanding of this, I'm still very new to Python and coding and just trying to learn how to properly track down problems that I encounter. I appreciate your help.

No problem. I do recommend you to move this discussion to branca though.

@nathan3leaf
Copy link
Author

Gotcha, I'll head over to branca. Thanks!

@FabeG
Copy link
Contributor

FabeG commented Mar 7, 2019

Hi @nathan3leaf,
No problem for me to build an exe using folium with cx_freeze.
Could you copy/paste the setup.py file you are using in order to find out what's going wrong ?

@nathan3leaf
Copy link
Author

@FabeG
This is what I have, which builds but crashes immediately when running the exe. Any guidance you can offer as to what else I need to add to this would be much appreciated.

from cx_Freeze import setup, Executable
import os.path
PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))
os.environ['TCL_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tcl8.6')
os.environ['TK_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tk8.6')

# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os","pandas","numpy","idna","branca","jinja2","matplotlib"]}

# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
    base = "Win32GUI"

options = {
    'build_exe': {
        'include_files':[
            os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tk86t.dll'),
            os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tcl86t.dll'),
         ],
    },
}

setup(  name = "projectName",
        version = "0.1",
        description = "My program",
        options = {"build_exe": build_exe_options},
        executables = [Executable("projectName.py", base=base)])```

@FabeG
Copy link
Contributor

FabeG commented Mar 7, 2019

@nathan3leaf could you try to add in the list of packages "pkg_resources" ?

build_exe_options = {"packages": ["pkg_resources", "os","pandas","numpy","idna","branca","jinja2","matplotlib"]}

@nathan3leaf
Copy link
Author

@FabeG
I gave it a shot and got this
2019-03-07

This is actually the same error I've been receiving when using cx_freeze, so it's getting tripped up in the same spot.

@FabeG
Copy link
Contributor

FabeG commented Mar 7, 2019

@nathan3leaf
I had to add also asyncio in the list of packages, could you try it ?

@nathan3leaf
Copy link
Author

@FabeG
I tried that and am now getting the error that stumps me when I use pyinstaller, which seems related to pkg_resources, which I did add to the setup file.

image

@FabeG
Copy link
Contributor

FabeG commented Mar 7, 2019

  • Does the file color_scale.js exists in install_dir / 'folium' / 'lib' / 'branca' / 'templates' ?
  • what version of setuptools are you using ?
import setuptools
print(setuptools.__version__)
  • what version of cx_freeze are you using ?
import cx_freeze
print(cx_freeze.__version__)

@nathan3leaf
Copy link
Author

@FabeG
yes, the color_scale.js file is residing in that folder
setuptools version 39.0.1
cx_freeze version 5.1.1

@nathan3leaf
Copy link
Author

I see now that my setuptools may be out of date

@nathan3leaf
Copy link
Author

I updated setuptools and no longer see the traceback related to pkg_resources or asyncio. However, in my script I have these lines:

def resource_path(relative_path): 
	try: 
		base_path = sys._MEIPASS
	except Exception:
		base_path = os.path.abspath(".")
	return os.path.join(base_path, relative_path)

homeDir = resource_path(os.path.dirname(os.path.abspath(__file__)))

which apparently it doesn't like because now I get an error that __file__ is not defined
I haven't seen this error before so I'm unsure how to resolve it, considering it has been working up until this point, at least when I made an exe that excluded folium

@FabeG
Copy link
Contributor

FabeG commented Mar 7, 2019

Seems you are about to solve your problem: for a frozen exe, you have to use sys.executable instead of __file__:

if getattr(sys, 'frozen', False):
    # The application is frozen
    datadir = os.path.dirname(sys.executable)
else:
    # The application is not frozen
    datadir = os.path.dirname(__file__)

@nathan3leaf
Copy link
Author

@FabeG Well I can't thank you enough for your patience and knowledge. My executable is FINALLY running when using folium. I've had to comment it out for months because I could never get it to run correctly, so this is actually a pretty big deal to me. Thanks so much!

@Conengmo Conengmo added the question The issue contains a question about how to do something label Mar 9, 2019
@Uzair919
Copy link

I updated setuptools and no longer see the traceback related to pkg_resources or asyncio. However, in my script I have these lines:

def resource_path(relative_path): 
	try: 
		base_path = sys._MEIPASS
	except Exception:
		base_path = os.path.abspath(".")
	return os.path.join(base_path, relative_path)

homeDir = resource_path(os.path.dirname(os.path.abspath(__file__)))

which apparently it doesn't like because now I get an error that __file__ is not defined
I haven't seen this error before so I'm unsure how to resolve it, considering it has been working up until this point, at least when I made an exe that excluded folium

I updated setuptools and no longer see the traceback related to pkg_resources or asyncio. However, in my script I have these lines:

def resource_path(relative_path): 
	try: 
		base_path = sys._MEIPASS
	except Exception:
		base_path = os.path.abspath(".")
	return os.path.join(base_path, relative_path)

homeDir = resource_path(os.path.dirname(os.path.abspath(__file__)))

which apparently it doesn't like because now I get an error that __file__ is not defined
I haven't seen this error before so I'm unsure how to resolve it, considering it has been working up until this point, at least when I made an exe that excluded folium

Could you please tell me the file name to add the code is it console.py or startup.py

@nathan3leaf
Copy link
Author

The last few code samples above were all added to my main project file, which of course would be different for you. However, the setup.py file which needs to be created in order to use cx_freeze, is also referenced above, which I've pasted below.

from cx_Freeze import setup, Executable
import os.path
PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.file))
os.environ['TCL_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tcl8.6')
os.environ['TK_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tk8.6')

Dependencies are automatically detected, but it might need fine tuning.

build_exe_options = {"packages": ["os","pandas","numpy","idna","branca","jinja2","matplotlib"]}

GUI applications require a different base on Windows (the default is for a

console application).

base = None
if sys.platform == "win32":
base = "Win32GUI"

options = {
'build_exe': {
'include_files':[
os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tk86t.dll'),
os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tcl86t.dll'),
],
},
}

setup( name = "projectName",
version = "0.1",
description = "My program",
options = {"build_exe": build_exe_options},
executables = [Executable("projectName.py", base=base)])```

@Uzair919
Copy link

image
How did you fix this error , i am receiving same error as yours

@Uzair919
Copy link

Can you guide me step by step i am new to python

@nathan3leaf
Copy link
Author

I had to be guided through the process myself, so I'm not sure I'm the one to provide the guidance. However, if you read this thread, you'll see that I had to essentially make three adjustment: 1. updated various packages that I was using - Tkinter, folium, setuptools, branca and some others. 2. I had to create and customize the setup.py file which tells cx_freeze where some things are and what should be included in the exe. 3. I had to update my file that contained the heart of my program's code, telling it what to do in the event it's 'frozen' as an exe.
Start with trying to address those 3 steps by going through the above thread. If you get to a stopping point, then post your question here and if I can help, I will.

@Uzair919
Copy link

i have done step 1 and 2 , the only problem i am trying to understand is to add this code - i mean to the main program or any specific file

def resource_path(relative_path): 
	try: 
		base_path = sys._MEIPASS
	except Exception:
		base_path = os.path.abspath(".")
	return os.path.join(base_path, relative_path)

homeDir = resource_path(os.path.dirname(os.path.abspath(__file__)))

plus i am trying to understand where to add the following code part too

if getattr(sys, 'frozen', False):
    # The application is frozen
    datadir = os.path.dirname(sys.executable)
else:
    # The application is not frozen
    datadir = os.path.dirname(__file__)

@nathan3leaf
Copy link
Author

In my program, I had several references to paths that I need to access. For example, if the user wants to view some details related to a building at a specific street address, a database would be referenced and the data would be retrieved from there. So, my old syntax may have been:

homeDir = "C://source//data.db"

Once an exe is made, this file path could have posed a problem if the user saved their exe in a different folder than what I did. So instead, at the start of my program, just after all of my imports, I have this:

def resource_path(relative_path):
    try:
        base_path = sys._MEIPASS
    except Exception:
        base_path = os.path.abspath(".")
    return os.path.join(base_path, relative_path)

The resource_path method helps to properly align where the program is looking for a file, relative to the location where the exe is saved. So, unless you have references in your program that are you file and folder locations. you don't need that module.

As for the second part:

    if getattr(sys, 'frozen', False):
        # The application is frozen
        datadir = os.path.dirname(sys.executable)
    else:
         # The application is not frozen
        datadir = os.path.dirname(__file__)

Add this at the beginning of your script, just after your imports and before the primary code of your program.

@nathan3leaf
Copy link
Author

The formatting of the code is throwing me off a little but I'll do my best to offer some ideas as to what would need to be changed.

It looks like you have two instances of the resource_path method. Remove the second one. Also, if you don't plan on having other users run this exe and/or you plan on always running it from the same directory, then you don't need to use the resource_path method. Here's an example of how I'm using it.

def resource_path(relative_path):
	try:
		base_path = sys._MEIPASS
	except Exception:
		base_path = os.path.abspath(".")
	return os.path.join(base_path, relative_path)

if getattr(sys, 'frozen', False):
	# The application is frozen
	# datadir = os.path.dirname(sys.executable)
	homeDir = resource_path(os.path.dirname(os.path.abspath(sys.executable)))
else:
	# The application is not frozen
	# datadir = os.path.dirname(__file__)
	homeDir = resource_path(os.path.dirname(os.path.abspath(__file__)))

imageDir = "%s%s" % (homeDir, "\\images\\")

So the variable homeDir uses resource_path to return the path of the exe. Regardless of where I save the exe, homeDir will refer to the folder in which the exe is saved. If I save the exe to my desktop, then homeDir will return the path to my desktop. The variable imageDir then uses the homeDir path as a starting point and then adds on \\images\\ meaning that it is expected that the images folder is expected to be on the desktop. So again, if you don't need to have this capability then you don't need to use the resource_path method.
Try removing that and be sure that method isn't referenced anywhere in your script. Paste in any error you get so it will be easier to determine where it's getting hung up.

@FabeG
Copy link
Contributor

FabeG commented Jun 6, 2019

Hi @Uzair919,
The problem comes from your setup.py file. Could you copy / paste it ?

@Uzair919
Copy link

Uzair919 commented Jun 7, 2019

@FabeG i am using windows 10 64 and python 3.7

@Uzair919
Copy link

Uzair919 commented Jun 7, 2019

so after manually copying tcl86 and tk86 files in exe folder i am getting this error now
image

@FabeG
Copy link
Contributor

FabeG commented Jun 7, 2019

It seems that your branca version is outdated: I can't see any _MEIPASS in the element.py file, on line 28. Could you update your branca version ?

@Uzair919
Copy link

@FabeG Hi again, so my EXE started working , but i couldnt understand why my plots are not being saved in the desired directory ? any help in this regard ,

@raulsangonzalo
Copy link

raulsangonzalo commented Feb 4, 2020

Hello, after having a play with it, I managed to compile it with PyInstaller. The problem has to do with relative paths, so changing the working directory within runtime and a few changes in the code does the trick. I stored some of the jsons in a python script as a quick fix, please check.

(branca)
colormap.py:

from branca.jsons import importCnames, importSchemes
# resource_package = __name__
# resource_path_schemes = '/_schemes.json'
# resource_path_cnames = '/_cnames.json'
# cnames_string = pkg_resources.resource_stream(
#     resource_package, resource_path_cnames).read().decode()
# _cnames = json.loads(cnames_string)
# schemes_string = pkg_resources.resource_stream(
#     resource_package, resource_path_schemes).read().decode()
# _schemes = json.loads(schemes_string)

#with open('cnames.json', 'w') as fp:
#    _cnames = json.dump(importCnames(), fp)
#with open('schemes.json', 'w') as fp:
#    _schemes = json.dump(importSchemes(), fp)

cnamesString = json.dumps(importCnames())
schemesString = json.dumps(importSchemes())

_cnames = json.loads(cnamesString)
_schemes = json.loads(schemesString)

Create a script (jsons.py) with this:

def importCnames():
    return {"indigo": "#4B0082", "gold": "#FFD700", "hotpink": "#FF69B4", "firebrick": "#B22222", "indianred": "#CD5C5C", "sage": "#87AE73", "yellow": "#FFFF00", "mistyrose": "#FFE4E1", "darkolivegreen": "#556B2F", "olive": "#808000", "darkseagreen": "#8FBC8F", "pink": "#FFC0CB", "tomato": "#FF6347", "lightcoral": "#F08080", "orangered": "#FF4500", "navajowhite": "#FFDEAD", "lime": "#00FF00", "palegreen": "#98FB98", "greenyellow": "#ADFF2F", "burlywood": "#DEB887", "seashell": "#FFF5EE", "mediumspringgreen": "#00FA9A", "fuchsia": "#FF00FF", "papayawhip": "#FFEFD5", "blanchedalmond": "#FFEBCD", "chartreuse": "#7FFF00", "dimgray": "#696969", "black": "#000000", "peachpuff": "#FFDAB9", "springgreen": "#00FF7F", "aquamarine": "#7FFFD4", "white": "#FFFFFF", "b": "#0000FF", "orange": "#FFA500", "lightsalmon": "#FFA07A", "darkslategray": "#2F4F4F", "brown": "#A52A2A", "ivory": "#FFFFF0", "dodgerblue": "#1E90FF", "peru": "#CD853F", "lawngreen": "#7CFC00", "chocolate": "#D2691E", "crimson": "#DC143C", "forestgreen": "#228B22", "slateblue": "#6A5ACD", "lightseagreen": "#20B2AA", "cyan": "#00FFFF", "mintcream": "#F5FFFA", "silver": "#C0C0C0", "antiquewhite": "#FAEBD7", "mediumorchid": "#BA55D3", "skyblue": "#87CEEB", "gray": "#808080", "darkturquoise": "#00CED1", "goldenrod": "#DAA520", "darkgreen": "#006400", "floralwhite": "#FFFAF0", "darkviolet": "#9400D3", "darkgray": "#A9A9A9", "moccasin": "#FFE4B5", "saddlebrown": "#8B4513", "darkslateblue": "#483D8B", "lightskyblue": "#87CEFA", "lightpink": "#FFB6C1", "mediumvioletred": "#C71585", "r": "#FF0000", "red": "#FF0000", "deeppink": "#FF1493", "limegreen": "#32CD32", "k": "#000000", "darkmagenta": "#8B008B", "palegoldenrod": "#EEE8AA", "plum": "#DDA0DD", "turquoise": "#40E0D0", "m": "#FF00FF", "lightgoldenrodyellow": "#FAFAD2", "darkgoldenrod": "#B8860B", "lavender": "#E6E6FA", "maroon": "#800000", "yellowgreen": "#9ACD32", "sandybrown": "#FAA460", "thistle": "#D8BFD8", "violet": "#EE82EE", "navy": "#000080", "magenta": "#FF00FF", "tan": "#D2B48C", "rosybrown": "#BC8F8F", "olivedrab": "#6B8E23", "blue": "#0000FF", "lightblue": "#ADD8E6", "ghostwhite": "#F8F8FF", "honeydew": "#F0FFF0", "cornflowerblue": "#6495ED", "linen": "#FAF0E6", "darkblue": "#00008B", "powderblue": "#B0E0E6", "seagreen": "#2E8B57", "darkkhaki": "#BDB76B", "snow": "#FFFAFA", "sienna": "#A0522D", "mediumblue": "#0000CD", "royalblue": "#4169E1", "lightcyan": "#E0FFFF", "green": "#008000", "mediumpurple": "#9370DB", "midnightblue": "#191970", "cornsilk": "#FFF8DC", "paleturquoise": "#AFEEEE", "bisque": "#FFE4C4", "slategray": "#708090", "darkcyan": "#008B8B", "khaki": "#F0E68C", "wheat": "#F5DEB3", "teal": "#008080", "darkorchid": "#9932CC", "deepskyblue": "#00BFFF", "salmon": "#FA8072", "y": "#FFFF00", "darkred": "#8B0000", "steelblue": "#4682B4", "g": "#008000", "palevioletred": "#DB7093", "lightslategray": "#778899", "aliceblue": "#F0F8FF", "lightgreen": "#90EE90", "orchid": "#DA70D6", "gainsboro": "#DCDCDC", "mediumseagreen": "#3CB371", "lightgray": "#D3D3D3", "c": "#00FFFF", "mediumturquoise": "#48D1CC", "darksage": "#598556", "lemonchiffon": "#FFFACD", "cadetblue": "#5F9EA0", "lightyellow": "#FFFFE0", "lavenderblush": "#FFF0F5", "coral": "#FF7F50", "purple": "#800080", "aqua": "#00FFFF", "lightsage": "#BCECAC", "whitesmoke": "#F5F5F5", "mediumslateblue": "#7B68EE", "darkorange": "#FF8C00", "mediumaquamarine": "#66CDAA", "darksalmon": "#E9967A", "beige": "#F5F5DC", "w": "#FFFFFF", "blueviolet": "#8A2BE2", "azure": "#F0FFFF", "lightsteelblue": "#B0C4DE", "oldlace": "#FDF5E6"}

def importSchemes():
    return {"viridis":["#440154","#481567","#482677","#453781","#404788","#39568C","#33638D","#2D708E","#287D8E","#238A8D","#1F968B","#20A387","#29AF7F","#3CBB75","#55C667","#73D055","#95D840","#B8DE29","#DCE319","#FDE725"],"Pastel1_03":["#fbb4ae","#b3cde3","#ccebc5"],

    "Pastel1_05":["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6"],"Pastel1_04":["#fbb4ae","#b3cde3","#ccebc5","#decbe4"],"Pastel1_07":["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd"],"YlOrRd_04":["#ffffb2","#fecc5c","#fd8d3c","#e31a1c"],"Pastel1_09":["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"],"Pastel1_08":["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec"],"Spectral_07":["#d53e4f","#fc8d59","#fee08b","#ffffbf","#e6f598",

    "#99d594","#3288bd"],"RdYlBu_05":["#d7191c","#fdae61","#ffffbf","#abd9e9","#2c7bb6"],"PuBuGn_03":["#ece2f0","#a6bddb","#1c9099"],"Set1_08":["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf"],"PuBuGn_05":["#f6eff7","#bdc9e1","#67a9cf",

    "#1c9099","#016c59"],"PuBuGn_04":["#f6eff7","#bdc9e1","#67a9cf","#02818a"],"PuBuGn_07":["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],"PuBuGn_06":["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#1c9099","#016c59"],"PuBuGn_09":["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],"PuBuGn_08":["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],

    "YlOrBr_04":["#ffffd4","#fed98e","#fe9929","#cc4c02"],"YlOrBr_05":["#ffffd4","#fed98e","#fe9929","#d95f0e","#993404"],"Set1_07":["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628"],"YlOrBr_03":["#fff7bc","#fec44f","#d95f0e"],"Set1_05":["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00"],"YlOrRd_03":["#ffeda0","#feb24c","#f03b20"],"PuOr_06":["#b35806","#f1a340","#fee0b6","#d8daeb","#998ec3","#542788"],"PuOr_07":["#b35806","#f1a340","#fee0b6","#f7f7f7","#d8daeb","#998ec3","#542788"],"PuOr_04":["#e66101","#fdb863","#b2abd2","#5e3c99"],"PuOr_05":["#e66101","#fdb863","#f7f7f7","#b2abd2","#5e3c99"],

    "PuOr_03":["#f1a340","#f7f7f7","#998ec3"],"Purples_09":["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],"Set2_06":["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f"],"RdYlBu_11":["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],"PuOr_08":["#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788"],

    "PuOr_09":["#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788"],"Paired_03":["#a6cee3","#1f78b4","#b2df8a"],"RdBu_03":["#ef8a62","#f7f7f7","#67a9cf"],"RdYlBu_10":["#a50026","#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],"Paired_07":["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f"],"Paired_06":["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99",

    "#e31a1c"],"Paired_05":["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99"],"Paired_04":["#a6cee3","#1f78b4","#b2df8a","#33a02c"],"Paired_09":["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6"],"Paired_08":["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00"],"RdGy_03":["#ef8a62","#ffffff","#999999"],"PiYG_04":["#d01c8b","#f1b6da","#b8e186","#4dac26"],"Accent_03":["#7fc97f","#beaed4","#fdc086"],"BuGn_08":["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],"BuGn_09":["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76",

    "#238b45","#006d2c","#00441b"],"BuGn_04":["#edf8fb","#b2e2e2","#66c2a4","#238b45"],"BuGn_05":["#edf8fb","#b2e2e2","#66c2a4","#2ca25f","#006d2c"],"BuGn_06":["#edf8fb","#ccece6","#99d8c9","#66c2a4","#2ca25f","#006d2c"],"BuGn_07":["#edf8fb","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],"BuGn_03":["#e5f5f9","#99d8c9","#2ca25f"],"YlGnBu_07":["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],"YlGnBu_06":["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#2c7fb8","#253494"],"YlGnBu_05":["#ffffcc","#a1dab4","#41b6c4","#2c7fb8","#253494"],"YlGnBu_04":["#ffffcc","#a1dab4","#41b6c4","#225ea8"],

    "YlGnBu_03":["#edf8b1","#7fcdbb","#2c7fb8"],"RdBu_06":["#b2182b","#ef8a62","#fddbc7","#d1e5f0","#67a9cf","#2166ac"],"RdBu_05":["#ca0020","#f4a582","#f7f7f7","#92c5de","#0571b0"],"RdBu_04":["#ca0020","#f4a582","#92c5de","#0571b0"],"Accent_08":["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],"RdBu_09":["#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac"],"RdBu_08":["#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac"],"Set2_04":["#66c2a5","#fc8d62","#8da0cb","#e78ac3"],"YlGnBu_09":["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb",

    "#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],"YlGnBu_08":["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],"Blues_08":["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],"Blues_09":["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],"RdPu_09":["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],"RdPu_08":["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],"Set3_07":["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69"],

    "Set3_06":["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462"],"RdPu_05":["#feebe2","#fbb4b9","#f768a1","#c51b8a","#7a0177"],"RdPu_04":["#feebe2","#fbb4b9","#f768a1","#ae017e"],"RdPu_07":["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],"RdPu_06":["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#c51b8a","#7a0177"],"Blues_06":["#eff3ff","#c6dbef","#9ecae1","#6baed6","#3182bd","#08519c"],"Blues_07":["#eff3ff","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],"RdPu_03":["#fde0dd","#fa9fb5","#c51b8a"],"Blues_05":["#eff3ff","#bdd7e7","#6baed6","#3182bd","#08519c"],"Paired_10":["#a6cee3",

    "#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a"],"Paired_11":["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99"],"Paired_12":["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],"PuBu_06":["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#2b8cbe","#045a8d"],"PuBu_07":["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],"PuBu_04":["#f1eef6","#bdc9e1","#74a9cf","#0570b0"],"PuBu_05":["#f1eef6","#bdc9e1","#74a9cf","#2b8cbe","#045a8d"],

    "PuRd_05":["#f1eef6","#d7b5d8","#df65b0","#dd1c77","#980043"],"PuBu_03":["#ece7f2","#a6bddb","#2b8cbe"],"PuRd_07":["#f1eef6","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"],"PuRd_06":["#f1eef6","#d4b9da","#c994c7","#df65b0","#dd1c77","#980043"],"PuRd_09":["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],"PuRd_08":["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a",

    "#ce1256","#91003f"],"Set2_07":["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494"],"PuBu_08":["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],"PuBu_09":["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],"RdBu_10":["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],"RdBu_11":["#67001f",

    "#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],"Accent_06":["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f"],"Set3_03":["#8dd3c7","#ffffb3","#bebada"],"Set3_05":["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3"],"Set3_12":["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],"Set3_10":["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd"],"Set3_04":["#8dd3c7","#ffffb3","#bebada","#fb8072"],"RdGy_11":["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],"RdGy_10":["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],"Set1_03":["#e41a1c","#377eb8","#4daf4a"],"Set1_09":["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],"Set3_09":["#8dd3c7","#ffffb3",

    "#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9"],"BuPu_08":["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],"BuPu_09":["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],"RdYlGn_11":["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],"Blues_03":["#deebf7","#9ecae1","#3182bd"],"Set2_05":["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854"],"BuPu_03":["#e0ecf4","#9ebcda","#8856a7"],"BuPu_06":["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8856a7","#810f7c"],"BuPu_07":["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],"BuPu_04":["#edf8fb","#b3cde3","#8c96c6","#88419d"],"BuPu_05":["#edf8fb","#b3cde3","#8c96c6","#8856a7","#810f7c"],"Accent_04":["#7fc97f","#beaed4","#fdc086","#ffff99"],"YlOrRd_05":["#ffffb2","#fecc5c","#fd8d3c","#f03b20","#bd0026"],"YlOrBr_08":["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],"Oranges_08":["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],"Oranges_09":["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],"Oranges_06":["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#e6550d","#a63603"],"Oranges_07":["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],"Oranges_04":["#feedde","#fdbe85","#fd8d3c","#d94701"],"YlOrBr_09":["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],"Oranges_03":["#fee6ce","#fdae6b","#e6550d"],"YlOrBr_06":["#ffffd4","#fee391","#fec44f","#fe9929","#d95f0e","#993404"],"Dark2_06":["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02"],"Blues_04":["#eff3ff","#bdd7e7","#6baed6","#2171b5"],"YlOrBr_07":["#ffffd4","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],"RdYlGn_05":["#d7191c","#fdae61","#ffffbf","#a6d96a","#1a9641"],"Set3_08":["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5"],"YlOrRd_06":["#ffffb2","#fed976","#feb24c","#fd8d3c","#f03b20","#bd0026"],"Dark2_03":["#1b9e77","#d95f02","#7570b3"],"Accent_05":["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0"],"RdYlGn_08":["#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850"],"RdYlGn_09":["#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850"],"PuOr_11":["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],"YlOrRd_07":["#ffffb2","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],"Spectral_11":["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],"RdGy_08":["#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d"],"RdGy_09":["#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d"],"RdGy_06":["#b2182b","#ef8a62","#fddbc7","#e0e0e0","#999999","#4d4d4d"],"RdGy_07":["#b2182b","#ef8a62","#fddbc7","#ffffff","#e0e0e0","#999999","#4d4d4d"],"RdGy_04":["#ca0020","#f4a582","#bababa","#404040"],"RdGy_05":["#ca0020","#f4a582","#ffffff","#bababa","#404040"],"RdYlGn_04":["#d7191c","#fdae61","#a6d96a","#1a9641"],"PiYG_09":["#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221"],"RdYlGn_06":["#d73027","#fc8d59","#fee08b","#d9ef8b","#91cf60","#1a9850"],"RdYlGn_07":["#d73027","#fc8d59","#fee08b","#ffffbf","#d9ef8b","#91cf60","#1a9850"],"Spectral_04":["#d7191c","#fdae61","#abdda4","#2b83ba"],"Spectral_05":["#d7191c","#fdae61","#ffffbf","#abdda4","#2b83ba"],"Spectral_06":["#d53e4f","#fc8d59","#fee08b","#e6f598","#99d594","#3288bd"],"PiYG_08":["#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221"],"Set2_03":["#66c2a5","#fc8d62","#8da0cb"],"Spectral_03":["#fc8d59","#ffffbf","#99d594"],"Reds_08":["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],"Set1_04":["#e41a1c","#377eb8","#4daf4a","#984ea3"],"Spectral_08":["#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd"],"Spectral_09":["#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd"],"Set2_08":["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],"Reds_09":["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],"Greys_07":["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],"Greys_06":["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#636363","#252525"],"Greys_05":["#f7f7f7","#cccccc","#969696","#636363","#252525"],"Greys_04":["#f7f7f7","#cccccc","#969696","#525252"],"Greys_03":["#f0f0f0","#bdbdbd","#636363"],"PuOr_10":["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],"Accent_07":["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17"],"Reds_06":["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#de2d26","#a50f15"],"Greys_09":["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],"Greys_08":["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],"Reds_07":["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],"RdYlBu_08":["#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4"],"RdYlBu_09":["#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4"],"BrBG_09":["#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e"],"BrBG_08":["#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e"],"BrBG_07":["#8c510a","#d8b365","#f6e8c3","#f5f5f5","#c7eae5","#5ab4ac","#01665e"],"BrBG_06":["#8c510a","#d8b365","#f6e8c3","#c7eae5","#5ab4ac","#01665e"],"BrBG_05":["#a6611a","#dfc27d","#f5f5f5","#80cdc1","#018571"],"BrBG_04":["#a6611a","#dfc27d","#80cdc1","#018571"],"BrBG_03":["#d8b365","#f5f5f5","#5ab4ac"],"PiYG_06":["#c51b7d","#e9a3c9","#fde0ef","#e6f5d0","#a1d76a","#4d9221"],"Reds_03":["#fee0d2","#fc9272","#de2d26"],"Set3_11":["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5"],"Set1_06":["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33"],"PuRd_03":["#e7e1ef","#c994c7","#dd1c77"],"PiYG_07":["#c51b7d","#e9a3c9","#fde0ef","#f7f7f7","#e6f5d0","#a1d76a","#4d9221"],"RdBu_07":["#b2182b","#ef8a62","#fddbc7","#f7f7f7","#d1e5f0","#67a9cf","#2166ac"],"Pastel1_06":["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc"],"Spectral_10":["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],"PuRd_04":["#f1eef6","#d7b5d8","#df65b0","#ce1256"],"OrRd_03":["#fee8c8","#fdbb84","#e34a33"],"PiYG_03":["#e9a3c9","#f7f7f7","#a1d76a"],"Oranges_05":["#feedde","#fdbe85","#fd8d3c","#e6550d","#a63603"],"OrRd_07":["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],"OrRd_06":["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#e34a33","#b30000"],"OrRd_05":["#fef0d9","#fdcc8a","#fc8d59","#e34a33","#b30000"],"OrRd_04":["#fef0d9","#fdcc8a","#fc8d59","#d7301f"],"Reds_04":["#fee5d9","#fcae91","#fb6a4a","#cb181d"],"Reds_05":["#fee5d9","#fcae91","#fb6a4a","#de2d26","#a50f15"],"OrRd_09":["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],"OrRd_08":["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],"BrBG_10":["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],"BrBG_11":["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],"PiYG_05":["#d01c8b","#f1b6da","#f7f7f7","#b8e186","#4dac26"],"YlOrRd_08":["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],"GnBu_04":["#f0f9e8","#bae4bc","#7bccc4","#2b8cbe"],"GnBu_05":["#f0f9e8","#bae4bc","#7bccc4","#43a2ca","#0868ac"],"GnBu_06":["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#43a2ca","#0868ac"],"GnBu_07":["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],"Purples_08":["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],"GnBu_03":["#e0f3db","#a8ddb5","#43a2ca"],"Purples_06":["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#756bb1","#54278f"],"Purples_07":["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],"Purples_04":["#f2f0f7","#cbc9e2","#9e9ac8","#6a51a3"],"Purples_05":["#f2f0f7","#cbc9e2","#9e9ac8","#756bb1","#54278f"],"GnBu_08":["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],"GnBu_09":["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],"YlOrRd_09":["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],"Purples_03":["#efedf5","#bcbddc","#756bb1"],"RdYlBu_04":["#d7191c","#fdae61","#abd9e9","#2c7bb6"],"PRGn_09":["#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837"],"PRGn_08":["#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837"],"PRGn_07":["#762a83","#af8dc3","#e7d4e8","#f7f7f7","#d9f0d3","#7fbf7b","#1b7837"],"PRGn_06":["#762a83","#af8dc3","#e7d4e8","#d9f0d3","#7fbf7b","#1b7837"],"PRGn_05":["#7b3294","#c2a5cf","#f7f7f7","#a6dba0","#008837"],"PRGn_04":["#7b3294","#c2a5cf","#a6dba0","#008837"],"PRGn_03":["#af8dc3","#f7f7f7","#7fbf7b"],"RdYlBu_06":["#d73027","#fc8d59","#fee090","#e0f3f8","#91bfdb","#4575b4"],"RdYlGn_10":["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],"YlGn_08":["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],"YlGn_09":["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],"RdYlBu_07":["#d73027","#fc8d59","#fee090","#ffffbf","#e0f3f8","#91bfdb","#4575b4"],"PiYG_10":["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],"PiYG_11":["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],"YlGn_03":["#f7fcb9","#addd8e","#31a354"],"YlGn_04":["#ffffcc","#c2e699","#78c679","#238443"],"YlGn_05":["#ffffcc","#c2e699","#78c679","#31a354","#006837"],"YlGn_06":["#ffffcc","#d9f0a3","#addd8e","#78c679","#31a354","#006837"],"YlGn_07":["#ffffcc","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],"Dark2_05":["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e"],"Dark2_04":["#1b9e77","#d95f02","#7570b3","#e7298a"],"Dark2_07":["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d"],"Pastel2_03":["#b3e2cd","#fdcdac","#cbd5e8"],"Pastel2_04":["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4"],"Pastel2_05":["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9"],"Pastel2_06":["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae"],"Pastel2_07":["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc"],"Pastel2_08":["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],"RdYlBu_03":["#fc8d59","#ffffbf","#91bfdb"],"Dark2_08":["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],"RdYlGn_03":["#fc8d59","#ffffbf","#91cf60"],"PRGn_11":["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],"Greens_08":["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],"Greens_09":["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],"Greens_06":["#edf8e9","#c7e9c0","#a1d99b","#74c476","#31a354","#006d2c"],"Greens_07":["#edf8e9","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],"Greens_04":["#edf8e9","#bae4b3","#74c476","#238b45"],"Greens_05":["#edf8e9","#bae4b3","#74c476","#31a354","#006d2c"],"PRGn_10":["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],"Greens_03":["#e5f5e0","#a1d99b","#31a354"]}

(folium) raster_layers.py

    tiles_flat = ''.join(tiles.lower().strip().split())

    os.chdir(os.path.dirname(os.path.abspath(__file__)))
    mainPath = os.getcwd()

    #if tiles_flat in ('cloudmade', 'mapbox') and not API_key:
    #    raise ValueError('You must pass an API key if using Cloudmade'
    #                     ' or non-default Mapbox tiles.')
    #templates = list(self._env.list_templates(
    #    filter_func=lambda x: x.startswith('tiles/')))


    tile_template = os.path.join(mainPath, 'templates/tiles/' + tiles_flat + '/tiles.txt')
    attr_template = os.path.join(mainPath, 'templates/tiles/' + tiles_flat + '/attr.txt')

    with open(tile_template) as f:
        self.tiles = f.read()
    with open(attr_template) as f:
        attr = f.read()
    #try:
    #    if tile_template in templates and attr_template in templates:
    #        self.tiles = self._env.get_template(tile_template).render(API_key=API_key)  # noqa
    #        attr = self._env.get_template(attr_template).render()
    #    else:
    #        self.tiles = tiles
    #        if not attr:
    #            raise ValueError('Custom tiles must have an attribution.')
    #except Exception as e:
    #    print(e)`

Lastly, when you compile, attach "folium\templates" to the location of your executable. Please, bear in mind this is just a quick fix, probably you will need a better code to account for other OS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question The issue contains a question about how to do something
Projects
None yet
Development

No branches or pull requests

6 participants