# -*- coding: utf-8 -*- # Sample showing how to add a custom web map from maperipy import Map from maperipy.webmaps import WebMap Map.clear() # the first argument is the name of your custom map # the second is the base URL of the Web map tiles (or multiple URLs if you have them) Map.add_web_map_custom("local", ["http://192.168.4.54:6789/openstreetmap-carto/tile"])
# -*- coding: utf-8 -*- # Sample showing how to add a standard web map from maperipy import Map from maperipy.webmaps import WebMap Map.clear() Map.add_web_map(WebMap.MapQuestOsm)
# -*- coding: utf-8 -*- # Sample showing how to add a custom web map from maperipy import Map from maperipy.webmaps import WebMap Map.clear() # the first argument is the name of your custom map # the second is the base URL of the Web map tiles (or multiple URLs if you have them) Map.add_web_map_custom("4umaps.eu", ["http://176.28.41.237" ])
# -*- coding: utf-8 -*- # Sample showing how to add an offline web map. # NOTE: in order for this to work, you need to place the web tiles into the Cache/WebTiles/MyOfflineMap # directory ('MyOfflineMap' is the provider name, you can change that, see below). The file structure # is the same as with the standard Web maps. # The easiest way to test this is to copy the Cache/WebTiles/OSM Mapnik directory to MyOfflineMap # and run this script. You will be show the standard OSM web map tiles, but only those that have # been cached on your disk, with no extra tiles downloading from the web. # Author: Igor Brejc # License: public domain from maperipy import Map from maperipy.webmaps import WebMapLayer Map.clear() # We create an offline web map layer, with the name of the layer specified. This name is then used # to find the tiles in the cache (Cache/WebTiles directory). offline_map = WebMapLayer.create_offline("MyOfflineMap") # Now we add that layer to the map. Map.add_layer(offline_map)
def remove_page_id_decoration(): """Remove the grid page ID decoration from the map.""" Map.remove_decoration("page_id")
# -*- coding: utf-8 -*- # Sample showing how to add a custom web map from maperipy import Map from maperipy.webmaps import WebMap Map.clear() # the first argument is the name of your custom map # the second is the base URL of the Web map tiles (or multiple URLs if you have them) Map.add_web_map_custom("4umaps.eu", ["http://176.28.41.237"])
def add_page_id_decoration(page_id): """Add the page ID decoration to the map.""" Map.add_decoration("page_id", lambda c : paint_page_id(page_id, c))
def add_page_id_decoration(page_id): """Add the page ID decoration to the map.""" Map.add_decoration("page_id", lambda c: paint_page_id(page_id, c))
# -*- coding: utf-8 -*- # Use Contour tiles from Cache/WebTiles/ContourTiles in Maperitive's installation directory from maperipy import Map from maperipy.webmaps import WebMapLayer contours_overlay = WebMapLayer.create_offline("ContourTiles") contours_overlay.draw_in_background = True # Now we add that layer to the map. Map.add_layer(contours_overlay)
# -*- coding: utf-8 -*- # Shows some simple capabilities of changing the default map painting workflow. # Author: Igor Brejc # License: public domain # The sample scripts tells Maperitive to skip rendering map text labels. # The cycles_to_output() method specifies the starting and ending paint cycles (the ending # cycle will not be included). # Here's a list of the default painting cycle values: # MapBackground = 100 # Landmass = 200 # BitmapBackground = 300 # LandUse = 400 # BitmapForeground = 500 # Infrastructure = 600 # Symbols = 700 # Labels (linear) = 799 # Labels (horizontal) = 800 # BitmapOverlay = 900 # Highlights = 950 # MapLegend = 1000 from maperipy import Map # This effectively skips cycles 799 and 800 with Map.init_workflow() as workflow: workflow.cycles_to_output(0, 799).cycles_to_output(801, 1001)