Change Location Dot to Image?
-
Hi, I am trying to figure out how to change the location dot to an image. I found that the svg path for the dot is located in the file titled interactive-map.php. the item that I would like to change is referenced below as “svgPath” => $targetSVG , and then $targetSVG (the second line of code) is defined with coordinates to make the shape of the icon that i’d like to exchange. How can I swap these coordinates for an image?
`function json_mapdata(){
$targetSVG = “M9,0C4.029,0,0,4.029,0,9s4.029,9,9,9s9-4.029,9-9S13.971,0,9,0z M9,15.93 c-3.83,0-6.93-3.1-6.93-6.93S5.17,2.07,9,2.07s6.93,3.1,6.93,6.93S12.83,15.93,9,15.93 M12.5,9c0,1.933-1.567,3.5-3.5,3.5S5.5,10.933,5.5,9S7.067,5.5,9,5.5 S12.5,7.067,12.5,9z”;
$countries = $this->mappoints();$args = array(“post_type” => “map_maps”, “posts_per_page”=> -1, “post_status” => “publish” );
$the_query = new WP_Query( $args );$images_array = array();
$areas = array();// The Loop
if ( $the_query->have_posts() ) {while ( $the_query->have_posts() ) { $the_query->the_post();
$id = get_the_ID();
$country_code = get_post_meta($id, “map_country”, true);
$map_color = get_post_meta($id, “map_color”, true);
if($country_code && isset($countries[$country_code])){$areas[] = array(
“id”=>$country_code,
“groupId”=>$country_code,
“color”=> ($map_color) ? $map_color : “#000000”
);$images_array[] = array(
“svgPath” => $targetSVG,
“zoomLevel”=> 2,
“scale”=> .7,
“color”=> “#ff1b2a”, /*JE small target dot*/
“title”=> $countries[$country_code][0],
“latitude”=> $countries[$country_code][1],
“longitude”=> $countries[$country_code][2],
“groupId”=> $country_code,
“custom”=> array(
“desc”=> ‘<div class=”phoca-flagbox”><span class=”phoca-flag ‘. strtolower($country_code) .'”></span></div>’ . get_the_content()
)
);
}
}
}echo json_encode(
array(
“map”=>”worldLow”,
“zoomOnDoubleClick”=>false,
“areas”=> $areas,
“images” => $images_array
)
);
exit;
}`
- The topic ‘Change Location Dot to Image?’ is closed to new replies.