Feature request

New home Forums Basic Version Feature request

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #10101
    erki
    Member

    I have a request to show existing polygons (and maybe everything?) on map if you add new polygon. I have to mark down 40 plots on the map and it would be nice to see where the previous border ended.

    Right now I added following code to line 398 in file {plugin_folder}/base/includes/wp-google-maps-polygons.php to do it, but it will be gone in next update so I hope you will develop this for the next update.

    
    <?php
                    $total_poly_array = wpgmza_b_return_polygon_id_array($mapid);
                    if ($total_poly_array > 0) {
                    foreach ($total_poly_array as $poly_id) {
                        $polyoptions = wpgmza_b_return_poly_options($poly_id);
                        $linecolor = $polyoptions->linecolor;
                        $lineopacity = $polyoptions->lineopacity;
                        $fillcolor = $polyoptions->fillcolor;
                        $fillopacity = $polyoptions->opacity;
                        if (!$linecolor) { $linecolor = "000000"; }
                        if (!$fillcolor) { $fillcolor = "66FF00"; }
                        if ($lineopacity == "") { $lineopacity = "1.0"; }
                        if ($fillopacity == "") { $fillopacity = "0.5"; }
                        $linecolor = "#".$linecolor;
                        $fillcolor = "#".$fillcolor;
                        
                        $poly_array = wpgmza_b_return_polygon_array($poly_id);
                        
                            
                ?> 
    
                <?php if (sizeof($poly_array) > 1) { ?>
    
                var WPGM_PathData_<?php echo $poly_id; ?> = [
                    <?php
                            foreach ($poly_array as $single_poly) {
                                $poly_data_raw = str_replace(" ","",$single_poly);
                                $poly_data_raw = explode(",",$poly_data_raw);
                                $lat = $poly_data_raw[0];
                                $lng = $poly_data_raw[1];
                                ?>
                                new google.maps.LatLng(<?php echo $lat; ?>, <?php echo $lng; ?>),            
                                <?php
                            }
                    ?>
                    
                   
                ];
                var WPGM_Path_<?php echo $poly_id; ?> = new google.maps.Polygon({
                  path: WPGM_PathData_<?php echo $poly_id; ?>,
                  strokeColor: "<?php echo $linecolor; ?>",
                  strokeOpacity: "<?php echo $lineopacity; ?>",
                  fillOpacity: "0.3",
                  fillColor: "<?php echo $fillcolor; ?>",
                  strokeWeight: 2
                });
    
                WPGM_Path_<?php echo $poly_id; ?>.setMap(this.map);
                    
                <?php } } ?>
                <?php } ?>
    
    Sincerely,
    Erki
    
    #10418
    Nick Duncan
    Keymaster

    Hi Erki
    Brilliant suggestion 🙂 I’ve added it to the “to do” list for the next few releases.
    Thank you very much for that.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘Feature request’ is closed to new replies.