Python帮助:gmplot中的路径

时间:2017-01-12 19:09:32

标签: python path polygon

我找不到有关在gmplot中使用路径的任何文档。我想出了这个接近的代码,但它连接了所有的行并用颜色填充它 - 我不希望这样。

我只想要一条这样的路径: http://imgur.com/3iaC2NQ

但是,我得到的是: http://imgur.com/ypXEqof

Heres是我的代码:

pathlon = -117.2974695,-117.2980671,-117.2984607,-117.2979182,-117.2974082,-117.2966604,-117.2977518,-117.2987498,-117.2981491,-117.297708,-117.2972804,-117.2965301,-117.2979485,-117.2975028,-117.2980506,-117.2982983,-117.2976609,-117.2970861,-117.2969908,-117.2981731,-117.2987695,-117.2981146,-117.2976909,-117.2969674,-117.2969299,-117.298394
pathlat = 33.27172039,33.27197757,33.27217535,33.27225324,33.27218351,33.27233921,33.27242614,33.27248971,33.27268346,33.27265944,33.27263664,33.27279608,33.27281652,33.27194103,33.27176546,33.27224514,33.27222714,33.27208829,33.27237357,33.27243373,33.27262189,33.27268296,33.27265933,33.27262125,33.27282274,33.27283925

gmap = gmplot.GoogleMapPlotter(pathlat[0],pathlon[0],18)

gmap.polygon(pathlat,pathlon,edge_color="cyan", edge_width=5, face_color=None, face_alpha=None, clickable = False)

gmap.draw('map.html')

希望有人能指出我正确的方向。

提前致谢!

1 个答案:

答案 0 :(得分:3)

由于您使用的是多边形,这是预期的结果。你应该使用情节方法。

请参阅以下部分;

pathlon = -117.2974695,-117.2980671,-117.2984607,-117.2979182,-117.2974082,-117.2966604,-117.2977518,-117.2987498,-117.2981491,-117.297708,-117.2972804,-117.2965301,-117.2979485,-117.2975028,-117.2980506,-117.2982983,-117.2976609,-117.2970861,-117.2969908,-117.2981731,-117.2987695,-117.2981146,-117.2976909,-117.2969674,-117.2969299,-117.298394
pathlat = 33.27172039,33.27197757,33.27217535,33.27225324,33.27218351,33.27233921,33.27242614,33.27248971,33.27268346,33.27265944,33.27263664,33.27279608,33.27281652,33.27194103,33.27176546,33.27224514,33.27222714,33.27208829,33.27237357,33.27243373,33.27262189,33.27268296,33.27265933,33.27262125,33.27282274,33.27283925

gmap = gmplot.GoogleMapPlotter(pathlat[0],pathlon[0],18)

gmap.plot(pathlat,pathlon,'cornflowerblue', edge_width=10)

gmap.draw('map.html')