Support » Plugin: OSM - OpenStreetMap » I need to geotag posts and show a map in the homepage with post geotagged

  • Resolved ita10

    (@ita10)


    Hello, I should geotag posts, some with one marker and some with more. In some cases I need also to show connection between the markers, like lines or similar.
    Then I should show in the homepage a map with all the markers, possibly with clustering, where clicking the marker appear the post with that tag and is possible to open them.
    These are my needs, but I’m becoming crazy to understand how to do.
    Are there any detailed docs with the explanations?
    I tried to see the examples, but the explanation is not too detailed for every step and for me is too much difficult to unsderstand.
    Thanks in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author MiKa

    (@photoweblog)

    Hello @ita10

    thank you for your feedback. This week we extented our documentation by a youtube channel to show some features of the OSM plugin:

    https://www.youtube.com/channel/UClbaig8Q4cqHgdO9DEKVDRg

    Nevertheless your needs are not covered by the WP OSM Plugin:

    WP OSM Plugin supports only one geotag per post but you need more.
    WP OSM Plugin does not support connection between geotags but you need them for some.

    The WP OSM Plugin is under GPL license and you do have a clear view to your needs, so finding a WordPress freelancer might be a good choice to adapt the plugin to your needs.

    Br, MiKa

    • This reply was modified 6 months, 3 weeks ago by MiKa.
    Plugin Author MiKa

    (@photoweblog)

    Since there is no feedback anymore I close it. Feel free to reopen if there are further questions.

    pablorotem

    (@pablorotem)

    hi i keep seeying thart nearly every question asked is not being answered as if the person asking it is the only one to benefit from it – ive been looking at your project for a while and the fact it is opens ource doesnt mean anything when you post a plugin to wordpress but offer zero support – ill reask the same question – how do i any type os auto geotag on wp posts? obviosly no one would download a plugin do display a single map so you answer is very unclrear – also saw the exact same answe in other places -if you do not intend to offer any spport perhaps better to just remove the plugin as most user can just create embadable maps derectly from osm and do not need a plugin for that – ill try to refine the question – lets say i have a site with classipress theme – how would i go on to replace the default google maps in it ? here is the piece of code that renders the map – <?php
    /**
    * Sidebar Google Maps template.
    *
    * @package ClassiPress\Templates
    * @author AppThemes
    * @since ClassiPress 3.0
    */
    ?>

    <div id=”gmap” class=”mapblock”>

    <?php
    $make_address = get_post_meta( $post->ID, ‘cp_street’, true ) . ‘ ‘ . get_post_meta( $post->ID, ‘cp_city’, true ) . ‘ ‘ . get_post_meta( $post->ID, ‘cp_state’, true ) . ‘ ‘ . get_post_meta( $post->ID, ‘cp_zipcode’, true );

    $coordinates = cp_get_geocode( $post->ID );
    ?>

    <script type=”text/javascript”>var address = “<?php echo esc_js($make_address); ?>”;</script>

    <?php cp_google_maps_js( $coordinates ); ?>

    <!– google map div –>
    <div id=”map”></div>

    </div>

    <?php
    /**
    * Outputs the javascripts for google maps.
    *
    * @param array $coordinates
    *
    * @return void
    */
    function cp_google_maps_js( $coordinates ) {
    ?>
    <script type=”text/javascript”>
    //<![CDATA[
    jQuery(document).ready(function($) {
    var clicked = false;

    if( $(‘#priceblock1’).is(‘:visible’) ) {
    map_init();
    } else {
    jQuery(‘a[href=”#priceblock1″]’).click( function() {
    if( !clicked ) {
    map_init();
    clicked = true;
    }
    });
    }

    });

    <?php
    if ( ! empty( $coordinates ) && is_array( $coordinates ) ) {
    echo ‘var SavedLatLng = new google.maps.LatLng(‘ . $coordinates[‘lat’] . ‘, ‘ . $coordinates[‘lng’] . ‘);’;
    $location_by = “‘latLng’:SavedLatLng”;
    $marker_position = “SavedLatLng”;
    } else {
    $location_by = “‘address’: address”;
    $marker_position = “results[0].geometry.location”;
    }
    ?>

    //var directionDisplay;
    //var directionsService = new google.maps.DirectionsService();
    var map = null;
    var marker = null;
    var infowindow = null;
    var geocoder = null;
    var fromAdd;
    var toAdd;
    var redFlag = “<?php echo esc_js( appthemes_locate_template_uri( ‘images/red-flag.png’ ) ); ?>”;
    var noLuck = “<?php echo esc_js( appthemes_locate_template_uri( ‘images/gmaps-no-result.gif’ ) ); ?>”;
    var adTitle = “<?php echo esc_js( get_the_title() ); ?>”;
    var contentString = ‘<div id=”mcwrap”><span>’ + adTitle + ‘</span><br />’ + address + ‘</div>’;

    function map_init() {
    jQuery(document).ready(function($) {
    $(‘#map’).hide();
    load();
    $(‘#map’).fadeIn(1000);
    codeAddress();
    });
    }

    function load() {
    geocoder = new google.maps.Geocoder();
    //directionsDisplay = new google.maps.DirectionsRenderer();
    var newyork = new google.maps.LatLng(40.69847032728747, -73.9514422416687);
    var myOptions = {
    zoom: 14,
    center: newyork,
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    mapTypeControlOptions: {
    style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
    }
    }
    map = new google.maps.Map(document.getElementById(‘map’), myOptions);
    //directionsDisplay.setMap(map);
    }

    function codeAddress() {
    geocoder.geocode( { <?php echo $location_by; ?> }, function(results, status) {
    if (status == google.maps.GeocoderStatus.OK) {
    marker = new google.maps.Marker({
    map: map,
    icon: redFlag,
    //title: title,
    animation: google.maps.Animation.DROP,
    position: <?php echo $marker_position; ?>
    });

    map.setCenter(marker.getPosition());

    infowindow = new google.maps.InfoWindow({
    maxWidth: 230,
    content: contentString,
    disableAutoPan: false
    });

    infowindow.open(map, marker);

    google.maps.event.addListener(marker, ‘click’, function() {
    infowindow.open(map,marker);
    });

    } else {
    (function($) {
    $(‘#map’).html(‘<div style=”height:400px;background: url(‘ + noLuck + ‘) no-repeat center center;”><p style=”padding:50px 0;text-align:center;”><?php echo esc_js( __( ‘Sorry, the address could not be found.’, APP_TD ) ); ?></p></div>’);
    return false;
    })(jQuery);
    }
    });
    }

    function showAddress(fromAddress, toAddress) {
    calcRoute();
    calcRoute1();
    }
    function calcRoute() {
    var start = document.getElementById(“fromAdd”).value;
    var end = document.getElementById(“toAdd”).value;
    var request = {
    origin: start,
    destination: end,
    travelMode: google.maps.DirectionsTravelMode.DRIVING
    };
    directionsService.route(request, function(response, status) {
    if (status == google.maps.DirectionsStatus.OK) {
    directionsDisplay.setDirections(response);
    }
    });
    }
    //]]>
    </script>

    <?php
    }

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.