Geotag posts and display map with geotags

The WordPress OSM Plugin supports geotagging for posts and pages.

  1. Install WP OSM Plugin
  2. Activate Options to see geotag and shortcode are at add post page
  3. Geotag your posts /pages

1.) Install WP OSM Plugin

Installation of WP OSM Plugin can be done simply in the backend like all other plugins.

2.) Add geotag to your post / page

Enable the Options for WP OSM Plugin geotag widget area when you create / edit your posts:

geotag widget in WordPress OpenStreetMap Plugin

geotag widget in WordPress OpenStreetMap Plugin

3.) Geotag your posts /pages

You can define an icon for the post page (optional) and add a geotag to it:

geotag widget in WordPress OpenStreetMap Plugin

geotag widget in WordPress OpenStreetMap Plugin

  1. If you do not select an icon here the default icon is shown in your overview map.
  2. Click into the map to define the geotag.
  3. Save the geotag to the page.

Note: You can add multiple geotags to one post / page, just separate them with space in the custom field, see also the Blog!

There is a shortcode generator to create the map with geotags:

geotag widget in WordPress OpenStreetMap Plugin

geotag widget in WordPress OpenStreetMap Plugin

You can define if you want to see geotags of posts, pages or any. You can also draw a line between them:

Geotag for WordPress OpenStreetMap Plugin OSM

Geotag for WordPress OpenStreetMap Plugin OSM

[*osm_map_v3 map_center="52.795,23.51" zoom="3" width="75%" height="300" tagged_type="post" marker_name="wpttemp-yellow.png"]

* <= remove asteriks

gefiltert nach “tutorial”:

[*osm_map_v3 map_center="52.795,23.51" zoom="3" width="75%" height="300" tagged_type="post" marker_name="wpttemp-yellow.png" tagged_filter="tutorial"]

There is also a widget to display a map with the geolocation at the post / page automatically. Just go to:

Deisgn => Widget to add and configure the widget:

OpenStreetMap Plugin Widget for WordPress

OpenStreetMap Plugin Widget for WordPress

You can see the widget with the map on this site.

You can also add autogenerated map to your WP-theme you this coding:

// echos a links to OpenStreetMap with post/page geo data.
OSM_echoOpenStreetMapUrl()
// returns a links to OpenStreetMap with post/page geo data.
OSM_getOpenStreetMapUrl()
// returns the Long value of post/page geo data
OSM_getCoordinateLong()
// returns the Lat value of post/page geo data
OSM_getCoordinateLat()

- - - Sample to add link to OSM with geo data in my template - - -
Add these lines in the emplate file to create a link with geo data of your post.

  <?php $NameOfPlace = get_the_title();?>
  <?php if (function_exists(OSM_echoOpenStreetMapUrl)) { ?>
    <?php if ((OSM_getCoordinateLong('osm'))&&(OSM_getCoordinateLat('osm'))) { ?>
      <?php _e(" - Map:"); ?>
      <?php echo "<a title='".$NameOfPlace."' target='_blank' href='".OSM_getOpenStreetMapUrl()."'> OSM</a >";?>
    <?php }?>
  <?php }?>