-
Book Overview & Buying
-
Table Of Contents
Geospatial Development By Example with Python
By :
Now that we have a function to generate the map and an easy way to preview them, we will experiment with the style options:
First, lets produce a bigger map so we can better see the changes. Edit the if __name__ == '__main__': block at the end of the map_functions.py file, changing the size argument of the create_map function call:
if __name__ == '__main__':
map_image = '../output/world3.png'
create_map('../../data/world_borders_simple.shp',
'map_style.xml',map_image, size=(1024, 500))
display_map(map_image)The map is the canvas for the drawing; it is possible to change the background color or the background image, the coordinate reference system, and a few other options.
Let's try changing the background:
In the file map_style.xml edit the map tag to change the background color. You can use a hexadecimal value, a color name, or an RGB combination. Try this as an example:
<Map background-color="#f8be78">
Run the code and see the changes.
Now...
Change the font size
Change margin width
Change background colour