If you want to embed a map into your post / page with the OSM plugin you have to use an OSM shortcode osm_map. An OSM shortcode always looks like:
[*osm_map lat="Num" lon="Num" <additional,optional arguments>] *remove the asterisk
I can be generated automatically at “settings => OSM” or directly where you edit your post / page. The shortest OSM shortcode looks like:
[*osm_map lat="37.11" lon="-8.654"] *remove the asterisk
and generates this map of Portugal:
Most modifications can be done with the OSM shortcode generator when you edit the post / page, but others can be found here. By adding three additional arguments map_border, theme and zoom you can zoom in and adapt the design:
[*osm_map lat="37.11" lon="-8.654" map_border="solid thin black" theme="dark" zoom="14"] *remove the asterisk
Only lat and lon are mendatory all other arguments are optional. Following are arguments with default settings, add these arguments to customize your map with marker, tracks, routes and borders …
BASIC MAP INFO lat default = "" (mendatory = center of the map) lon default = "" (mendatory = center of the map) width default = "450" (for percentage add % otherwise pixel; has to be > 0 ) height default = "300"(for percentage add % otherwise pixel; has to be > 0 ) zoom default = "7" () type default = "AllOsm" (Mapnik, CycleMap, OpenSeaMap, OpenWeatherMap, basemap_at, stamen_watercolor, stamen_toner, GooglePhysical, GoogleStreet, GoogleHybrid, GoogleSatellite, AllOsm, AllGoogle) map_border default = "none" (standard css, eg: "thin solid blue") theme default = "ol" (ol, ol_orange, dark)
Samples for basic maps are here.
ICON / MARKER marker default = "No" (eg: marker="33.54,85.333,Customfieldname") marker_name default = "NoName" (OSM Plugin marker or path to personal marker eg: marker_name="../../../uploads/BikeLogo.png) marker_height default = "0" (eg: marker_height="23") marker_width default = "0" (eg: marker_width="23") marker_focus default = "0" ("0"=center, "1"=left bottom, "2"=left top, "3"=right top, "4"=right bottom, "5"=center bottom) marker_routing default = "No" ("ors"=oupenroutservice, "cm"=cloudmade, "yn"=yournavigation)
Samples for maps with marker are here.
GPX ROUTES TRACKS gpx_file default = "NoFile" (absolut or relative on the blog domain) gpx_colour default = "NoColour" (eg "green") gpx_file_list default = "NoFileList" (eg ="../../../../wp-content/uploads/GPX_red.gpx,<second file>,<third file>") gpx_colour_list default = "NoFileListColour" (eg for three files: "red,green,blue")
Samples for maps with GPX files are here.
KML FILE (ROUTES, POLYGONS, ...) kml_file default = "NoFile" (absolut or relative on the blog domain) kml_colour default = "NoColour" () kml_file_list default = "NoFileList" (eg ="../../../../wp-content/uploads/file_01.kml,<second file>,<third file>") kml_colour_list default = "NoFileListColour" (eg for three files: "red,green,blue")
Samples for maps with KML files are here. sample: Adding gps logger data to map
LIST OF MARKER IN TEXT FILE marker_file default = "NoFile" (absolut or relative on the blog domain)
Sample for map with markerfile here.
GEOTAGGED POSTS / PAGES import default = "No" ("osm" post/pages with marker,"osm_l" post/pages with marker and link) post_type default = "post" (filter and show only "post", "page", "any") import_osm_cat_incl_name defautl = "Osm_All" (include one category) import_osm_cat_excl_name default = "Osm_None" (exclude on category) import_osm_line_width default = "4" (has to be combined with import="osm" or import="osm_l"!) import_osm_line_color default = "none" (css colours, connect post / pages with line) import_osm_line_opacity default = "0.9" ()
sample: add tagged posts of the blog
sample: add geocaches
loading an external map
You have to set: type=”Ext” and use these arguments:
- extmap_type…the layertype []
- extmap_name…any name for the map []
- extmap_address…URL to find the map []
- extmap_init…some more details for loading/init the maplayer []
sample:[*osm_map long=”-0.163″ lat=”51.483″ control=”scaleline,scale” zoom=”14″ width=”500″ height=”450″ extmap_type=”OSM” extmap_name=”UK_Map” extmap_address=”http://b.ooc.openstreetmap.org/os1/${z}/${x}/${y}.jpg” extmap_init=”numZoomLevels: 17, transitionEffect: ‘resize’, sphericalMercator: true” type=”ext”]
adding controls an overviewmap in your map
- ov_map…adds the overviewmap with zoomlevel 0..17 [*osm_map … ov_map=”0″]
- control…adds various controls to your map [*osm_map … control=”scaleline,scale,mouseposition”]
Some WP themes need adaptions of CSS.
CSS z_index default = "none" (changes the z-index of the map div)