问题描述
我使用Google Maps API v3撰写了一个HTML文件。
我想要做的就是为几个国家着色,例如,中国的颜色和加拿大红。什么是简单的解决方案(不涉及多边形和几千个坐标)在各个国家进行着色?
在浏览以前的StackOverFlow问题后,似乎有三种常见解决方案。然而,这3种解决方案似乎并不适合我的情况。
-
图表API
- 我不太明白如果Charts API对我来说是一个很好的解决方案,因为我已经有一个使用Google Maps API的文件。除非Chart可以应用在我的地图上,或者与地图同步,否则这似乎不是有效的解决方案。 b $ b - 此向导(据我所知)处理一般特征的样式,如道路,水,人口等。除非有人能告诉我如何为特定国家分配一种颜色,否则我不明白可以工作。 -
多边形
- 我看到了百慕大三角形的例子,其他人建议获得一个国家的边界坐标并创建一个多边形。这可能会起作用,除了我可能需要数千个坐标才能完整勾画中国。也许有一种更简单的方法,我可以在一个国家的颜色?
Charts API-I don't really understand if Charts API is a good solution for me because I have already have a file using Google Maps API. Unless Charts can be applied over my map, or synchronize with the map, this does not seem to be a valid solution.
Styling (With Styling Wizard)-This wizard (as far as I know) deals with the style of general characteristics, like road, water, population, etc. Unless someone can show me how to assign a specific country a color, I do not see how this can work.
Polygons-I saw the example of the Bermuta triangle and other people have suggested to get the coordinates of the perimeter of a country and create a polygon. This may work except I may need a thousands of coordinates in order to fully outline China. Perhaps there is a more simple method in which I can color in a country?
使用FusionTablesLayer或KmlLayer。
这两种格式都需要格式化的地理数据并将其呈现在地图上,这样可以获得更好的复杂或大量多边形效果。 可在,并包含大多数国家。
I have a written up HTML file using the Google Maps API v3.
All I want to do is color a couple of countries, for example, color in China and Canada to red. What is a simple solution (that doesn't involve Polygons and thousands of coordinates) to color in countries?
After browsing previous StackOverFlow questions, there seemed to be three common solutions. However these 3 solutions do not seem appropriate for my situation.
Use either FusionTablesLayer or KmlLayer.Both take kml formated geographical data and render it on tiles, yielding better performance with complex or large numbers of polygons.
The Natural Earth data set is available in Fusion Tables, and contains most countries.
这篇关于国家的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!