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

You can define if you want to see geotags of posts, pages or any:

[*osm_map_v3 map_center="52.795,23.51" zoom="3" width="75%" height="300" tagged_type="post" marker_name="mic_blue_pinother_02.png" type="stamen_watercolor"]

* <= remove asteriks

You can also cluster your tagged posts/pages:

[*osm_map_v3 map_center="52.795,23.51" zoom="3" width="75%" height="300" tagged_type="post" marker_name="mic_black_pinother_02.png" tagged_param="cluster" tagged_color="black" type="stamen_watercolor"]

* <= remove asteriks

And you can filter it for categories like “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 }?>