gpt4 book ai didi

javascript - 我如何在 google Geomap 中获取 "Bangalore,Karnataka,India"的区域代码?

转载 作者:行者123 更新时间:2023-11-28 01:51:56 24 4
gpt4 key购买 nike

您好,我想使用 google Geomap 在 map 中显示“类加罗尔”(INDIA)。我从 developer.google.com 网站获得了一个代码,我已经为印度创建了一个代码,使用

option['region']="IN";

但我想要“类加罗尔”(印度的一个主要城市) map 而不是印度。有什么办法可以做到这一点。

请检查印度的代码

<html>
<head>
<script type='text/javascript' src='https://www.google.com/jsapi'></script>
<script type='text/javascript'>
google.load('visualization', '1', {'packages': ['geomap']});
google.setOnLoadCallback(drawMap);

function drawMap() {
var data = google.visualization.arrayToDataTable([
['City', 'Popularity'],
['Karnataka', 200],
['Delhi', 300],


['Bihar', 600],
['Kerala', 700]
]);

var options = {};
options['region'] = 'IN';
options['colors'] = [0xFF8747, 0xFFB581, 0xc06000]; //orange colors


var container = document.getElementById('map_canvas');
var geomap = new google.visualization.GeoMap(container);
geomap.draw(data, options);
};

</script>
</head>

<body>
<div id='map_canvas'></div>
</body>

</html>

输出是 enter image description here

最佳答案

Google 没有适用于印度城市的 API。我在创建孟买 map 时遇到了同样的问题。

我使用这个网站来这样做。 http://www.image-maps.com/

所以你基本上给出了类加罗尔的静态 map 。该网站将为您创建一个对象,您可以下载该代码。

试试吧!

在将孟买划分为市政区时为我工作。

关于javascript - 我如何在 google Geomap 中获取 "Bangalore,Karnataka,India"的区域代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19619494/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com