为什么Google地图几何与图形库冲突 [英] why google map geometry conflict with drawing library

查看:114
本文介绍了为什么Google地图几何与图形库冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在同一页面上同时使用库图形和几何图形时,几何解码路径功能不起作用.如何解决这个问题?

When I use both library drawing and geometry at same page, geometry decodePath function not work. how to fix this problem?

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=falselibraries=drawing"></script>

<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false&libraries=geometry"></script>

google.maps.geometry.encoding.encodePath(latlngs);

google.maps.geometry.encoding.decodePath(encodedPolyline);

推荐答案

您没有正确包含它.

您将包含两次API,一次包含在图形库中(这是不正确的),一次包含在几何库中.

You are including the API twice, once with the drawing library (and that is incorrect), and once with the geometry library.

代替:

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=falselibraries=drawing"></script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false&libraries=geometry"></script>

尝试使用记录的方式 [要请求多个库,请使用逗号:]

Try the documented way [To request multiple libraries, separate them with a comma:]

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&libraries=drawing,geometry"></script>

这篇关于为什么Google地图几何与图形库冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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