Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/464.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 带标签的谷歌地图圈_Javascript_Php_Jquery_Google Maps - Fatal编程技术网

Javascript 带标签的谷歌地图圈

Javascript 带标签的谷歌地图圈,javascript,php,jquery,google-maps,Javascript,Php,Jquery,Google Maps,我使用google map api创建了地图视图,使用google.maps.Circle Circle在地图上打印并没有任何问题,但我不能在地图上添加标签或文本。我怎样才能解决这个问题 这是我用来打印圆圈的代码 function initialize() { var frrlanser_marker = { strokeColor: '#FF0000', strokeOpacity: 0.8, st

我使用google map api创建了地图视图,使用google.maps.Circle Circle在地图上打印并没有任何问题,但我不能在地图上添加标签或文本。我怎样才能解决这个问题

这是我用来打印圆圈的代码

   function initialize() {

        var frrlanser_marker = {
            strokeColor: '#FF0000',
            strokeOpacity: 0.8,
            strokeWeight: 2,
            fillColor: '#FF0000',
            fillOpacity: 0.35,
            radius: 60 * 100
        };



        var latlng = new google.maps.LatLng(6.951974, 80.720160);
        var myOptions = {
            scrollwheel: false,
            zoom: 10,
            center: latlng,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };

        var map = new google.maps.Map(document.getElementById("map"),
            myOptions);

<?php foreach($results as $val): ?>
<?php if($val->geo_location != ""): ?>

      <?php if($val->fontUserTypeId == 1) { ?>
        var fill_color_val = '#3888ff';
      <?php } else { ?>
        var fill_color_val = '#70d04f';
     <?php  } ?>




   <?php $LatLng = explode(",", $val->geo_location); ?>

    var latitude = <?php echo $LatLng[0]; ?>;
    var lontitude = <?php echo $LatLng[1]; ?>;

    var myLatLng = {lat: latitude, lng: lontitude};

    var marker = new google.maps.Marker({
        position: myLatLng,
        map: map
    });

       // Add circle overlay and bind to marker
        var circle = new google.maps.Circle({
            map: map,
            radius: 3200,    // 10 miles in metres
            fillColor: fill_color_val,
            strokeColor: '#FFFFFF',
            strokeWeight: 2,
            fillOpacity: 1,
        });
        circle.bindTo('center', marker, 'position');

        marker.setVisible(false);
可以在圆上添加带有所需标签/文本的

代码片段:

函数初始化(){
变量frrlanser_标记={
strokeColor:“#FF0000”,
笔划不透明度:0.8,
冲程重量:2,
填充颜色:'#FF0000',
不透明度:0.35,
半径:60*100
};
var latlng=新的google.maps.latlng(6.951974,80.720160);
变量myOptions={
滚轮:错误,
缩放:10,
中心:拉特林,
mapTypeId:google.maps.mapTypeId.ROADMAP
};
var map=new google.maps.map(document.getElementById(“map”),
肌肽);
变量fill_color_val='#3888ff';
var纬度=6.951974;
lontitude变量=80.720160;
var mylatng=google.maps.LatLng(纬度,lontitude);
var marker=new google.maps.marker({
位置:latlng,
地图:地图
});
//添加圆形覆盖并绑定到标记
var circle=new google.maps.circle({
地图:地图,
半径:3200,//10英里(米)
fillColor:fill_color_val,
strokeColor:“#FFFFFF”,
冲程重量:2,
不透明度:1,
});
圆圈.bindTo('中心',标记,'位置');
marker.setVisible(假);
var labelText=“1”;
变量myOptions={
内容:labelText,
箱式:{
边界:“无”,
textAlign:“居中”,
字体大小:“10磅”,
宽度:“50px”
},
是的,
pixelOffset:new google.maps.Size(-25,-5),
位置:latlng,
closeBoxURL:“”,
伊希登:错,
窗格:“浮动窗格”,
enableEventPropagation:true
};
var ibLabel=新信息框(myOptions);
ibLabel.open(map);
}
google.maps.event.addDomListener(窗口“加载”,初始化)
html,
身体,
#地图{
身高:100%;
宽度:100%;
边际:0px;
填充:0px
}

您可以在圆圈上添加一个带有所需标签/文本的圆圈

代码片段:

函数初始化(){
变量frrlanser_标记={
strokeColor:“#FF0000”,
笔划不透明度:0.8,
冲程重量:2,
填充颜色:'#FF0000',
不透明度:0.35,
半径:60*100
};
var latlng=新的google.maps.latlng(6.951974,80.720160);
变量myOptions={
滚轮:错误,
缩放:10,
中心:拉特林,
mapTypeId:google.maps.mapTypeId.ROADMAP
};
var map=new google.maps.map(document.getElementById(“map”),
肌肽);
变量fill_color_val='#3888ff';
var纬度=6.951974;
lontitude变量=80.720160;
var mylatng=google.maps.LatLng(纬度,lontitude);
var marker=new google.maps.marker({
位置:latlng,
地图:地图
});
//添加圆形覆盖并绑定到标记
var circle=new google.maps.circle({
地图:地图,
半径:3200,//10英里(米)
fillColor:fill_color_val,
strokeColor:“#FFFFFF”,
冲程重量:2,
不透明度:1,
});
圆圈.bindTo('中心',标记,'位置');
marker.setVisible(假);
var labelText=“1”;
变量myOptions={
内容:labelText,
箱式:{
边界:“无”,
textAlign:“居中”,
字体大小:“10磅”,
宽度:“50px”
},
是的,
pixelOffset:new google.maps.Size(-25,-5),
位置:latlng,
closeBoxURL:“”,
伊希登:错,
窗格:“浮动窗格”,
enableEventPropagation:true
};
var ibLabel=新信息框(myOptions);
ibLabel.open(map);
}
google.maps.event.addDomListener(窗口“加载”,初始化)
html,
身体,
#地图{
身高:100%;
宽度:100%;
边际:0px;
填充:0px
}

相关问题:相关问题:
    }

    google.maps.event.addDomListener(window, "load", initialize);