如何在Google Maps v3中将polowindow放在多段线上? [英] How to put a infowindow on polyline in Google Maps v3?

查看:74
本文介绍了如何在Google Maps v3中将polowindow放在多段线上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何在使用 Google Maps Api时在 polyline 上显示 infowindow V3 ?并出现在折线的中间?!

解决方案

首先,您需要计算折线的中间/中间。这已经在这里讨论和回答了;
https://stackoverflow.com/a/9090409/787921



然后您将必须打开infowindow;

$ p $ var infowindow = new google.maps.InfoWindow({
content:infowindow text content});
infowindow.setPosition(midLatLng);
infowindow.open(map);


I want to know how to show infowindow on polyline in using Google Maps Api V3? and to appear in the middle of the polyline ?!

解决方案

Firstly you will need to calculate the middle/center of the polyline. This has been discussed and answered here; https://stackoverflow.com/a/9090409/787921

Then you will have to open the infowindow;

var infowindow = new google.maps.InfoWindow({
             content: "infowindow text content"});
infowindow.setPosition(midLatLng);
infowindow.open(map);

这篇关于如何在Google Maps v3中将polowindow放在多段线上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆