WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Pronamic Google Maps] Lat and Long position for Mashup view (3 posts)

  1. tictok
    Member
    Posted 2 years ago #

    Hiya - hope you can help..

    I'm using the excellent Pronamic Google Maps plugin but no matter what I do I can't figure out how to get the mashup map to centre on coordinates of my choice.

    The is the code I've used:

    <?php
    $iconurl = get_bloginfo('template_directory').'/library/images/emw-icon.png';
    
    if(function_exists('pronamic_google_maps_mashup')) {
    	pronamic_google_maps_mashup(
    		array(
    			'post_type' => 'branches'
    		) ,
    		array(
    			'width' => 300 ,
    			'height' => 450 ,
    			'zoom' => 5 ,
    			'latitude' => 21.414145 ,
    			'longitude' => -10.414145 ,
    			'fit_bounds' => false ,
    			'map_type_id' => 'terrain' ,
    			'marker_options' => array(
    			    'icon' => $iconurl
    			),
    			'map_options' => array(
    				'streetViewControl' => false,
    				'disableDefaultUI' => true,
    				'draggable' => false,
    				'disableDoubleClickZoom' => true
    							)
    	));
    } ?>

    As you can see I'm using a custom post type and my own icon, which both work fine.
    I want the map to be completely static so have removed user controls.

    Setting the zoom level works, but I'm stuck trying to get the map to centre on my chosen location. Where am i going wrong?

    Thanks in advance!
    Stef

  2. jcow
    Member
    Posted 2 years ago #

    Centering doesn't seem to work in the current version. Pretty frustrating. I am working on finding a way myself. If I come across it, I will let you know...

  3. jcow
    Member
    Posted 2 years ago #

    I think this has worked, but it is weird, because it centered for me previously, but not for others.

    jQuery(document).ready(function($) {
    	// Mashup
    	jQuery(".pgmm").bind("pronamic-google-maps-ready", function(event, map){
    		map.setCenter(new google.maps.LatLng(34.452218, -83.320312));
    	});
    });

    Add that to your javascript to force it to center on the lat/lon. Add it after the code that adds your map. Hopefully that works.

Topic Closed

This topic has been closed to new replies.

About this Topic