小编Ste*_*ith的帖子

从谷歌地图drawingManager V3中删除多边形

我有一个用户可编辑的谷歌地图,用户可以使用绘图管理器在地图上绘制叠加多边形.这工作正常,控制台记录我需要的lat lngs.但是,我需要添加一个清除多边形地图的按钮,以便在出现错误时再次绘制.我的实现代码粘贴在下面:

geocoder = new google.maps.Geocoder();
      var latlng = new google.maps.LatLng(<?php echo $latitude ?>, <?php echo $longitude ?>);
       var myOptions = {
         zoom: <?php echo $zoomlevel ?>,
         center: latlng,
         mapTypeId: google.maps.MapTypeId.ROADMAP
       };
       var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

       marker = new google.maps.Marker({
         map:map,
         draggable:true,
         animation: google.maps.Animation.DROP,
         position: latlng
       })

       pos = marker.position;
       //alert(pos);
       document.getElementById("gpsite-surgery-latitude").value = pos.lat();
       document.getElementById("gpsite-surgery-longitude").value = pos.lng();

       google.maps.event.addListener(marker, "dragend", function() {
               var myLatLng = marker.latLng;

               pos = marker.position;
               //alert(pos);
               document.getElementById("gpsite-surgery-latitude").value = pos.lat();
               document.getElementById("gpsite-surgery-longitude").value = pos.lng();
       })

       google.maps.event.addListener(map, 'zoom_changed', …
Run Code Online (Sandbox Code Playgroud)

javascript jquery google-maps-api-3

13
推荐指数
2
解决办法
3万
查看次数

使用fpdf修改php中的现有pdf

我的服务器上有一组pdfs,下载时需要在每页上附加文字.我正在使用fpdf尝试打开文件,将文本附加到每个页面,关闭文件并提供给浏览器.

$pdf = new FPDI();

$pdf->setSourceFile($filename); 
// import page 1 
$tplIdx = $pdf->importPage(1); 
//use the imported page and place it at point 0,0; calculate width and height
//automaticallay and ajust the page size to the size of the imported page 
$pdf->useTemplate($tplIdx, 0, 0, 0, 0, true); 

// now write some text above the imported page 
$pdf->SetFont('Arial', '', '13'); 
$pdf->SetTextColor(0,0,0);
//set position in pdf document
$pdf->SetXY(20, 20);
//first parameter defines the line height
$pdf->Write(0, 'gift code');
//force the browser to download …
Run Code Online (Sandbox Code Playgroud)

php pdf fpdf

7
推荐指数
2
解决办法
3万
查看次数

使用api v3在google地图上添加infowindow到循环标记数组

我有一个在js中循环的数组,用于在谷歌地图上放置自定义标记.我需要为每个标记添加一个隐藏的信息窗口,以便在单击时显示相关的信息窗口.目前我正在做以下事情:

for(var i=0; i<google_map_item.length; i++)
    {
        latlon = new google.maps.LatLng(google_map_item[i].lat, google_map_item[i].lon)
        bounds.extend(latlon);
        var iconcolor = google_map_item[i].iconColor;
        marker = new google.maps.Marker({
            map: map,
            position: latlon,
            icon: "https://chart.googleapis.com/chart?chst=d_map_pin_letter_withshadow&chld=" + (i + 1) + "|"+iconcolor+"|000000",
            type: 'flat',
            icon_color: '#ff0000', 
            label_color: '#ffffff', 
            width: '20', 
            height: '20', 
            label_size: '11',
                            clickable: true
        });

        marker.info = new google.maps.InfoWindow({
                        content: '<b>Speed:</b> knots'
                    });

                    google.maps.event.addListener(marker, 'click', function() {
                        marker.info.open(map, marker);
                    });

        map.fitBounds(bounds);
    }
Run Code Online (Sandbox Code Playgroud)

但是,这只会创建一个信息框,无论您点击哪一点,都会显示该信息框.

谢谢你的帮助

javascript google-maps google-maps-api-3

3
推荐指数
1
解决办法
1万
查看次数

谷歌地图中的动态内容api v3多个自定义标记上的信息窗口

我有以下js实现谷歌地图与循环通过自定义标记集.我需要每个标记具有不同的信息窗口,因此当您单击标记时,您将获得相关的内容.在一分钟它没有打开infowindow并且没有在控制台中给我一个错误

infowindow = new google.maps.InfoWindow();

    for(var i=0; i<google_map_item.length; i++)
    {
        latlon = new google.maps.LatLng(google_map_item[i].lat, google_map_item[i].lon)
        bounds.extend(latlon);
        var iconcolor = google_map_item[i].iconColor;
        marker = new google.maps.Marker({
            map: map,
            position: latlon,
            icon: "https://chart.googleapis.com/chart?chst=d_map_pin_letter_withshadow&chld=" + (i + 1) + "|"+iconcolor+"|000000",
            type: 'flat',
            icon_color: '#ff0000', 
            label_color: '#ffffff', 
            width: '20', 
            height: '20', 
            label_size: '11',
                            clickable: true
        });

                    google.maps.event.addListener(marker, 'click', function() {
                        //marker.info.open(map, this);
                        infowindow.setContent(this.latlon);
                        infowindow.open(map, this);
                    });


        map.fitBounds(bounds);
    }
Run Code Online (Sandbox Code Playgroud)

javascript google-maps google-maps-api-3

3
推荐指数
1
解决办法
1万
查看次数

无法显示PHP错误

出于某种莫名其妙的原因,我的PHP不会显示错误.我一直在编写一个脚本,我现在正在测试和调试,但是我得到的只是一个白页,即使我贴上了回声1; 在第1行.在我的文档的顶部,我有以下错误覆盖尝试并显示错误:

ini_set("display_errors", 1);
ini_set("track_errors", 1);
ini_set("html_errors", 1);
error_reporting(E_ALL);
Run Code Online (Sandbox Code Playgroud)

我无法更改全局php.ini文件,因为这会覆盖其他实时网站的设置.

php error-handling

0
推荐指数
1
解决办法
3598
查看次数