Google Maps and a lot of path points (long polyline)

不想你离开。 提交于 2019-12-10 14:18:24

问题


I try to integrate Google's static Maps service in my C# application. It should plot a custom route on a map. For example:

http://maps.google.com/maps/api/staticmap?size=512x512&path=color:0x0000ff|weight:5|40.737102,-73.990318|40.749825,-73.987963&sensor=false

This works well for a few path points (~ <75) but if the route is long enough the URI exceeds the 2048 characters limit and I get a 414 error message.

Is it possible to bypass this problem, perhaps with a POST?

Thank you!


回答1:


if you have a web serve you can save the points in a KML file hosted on your webserver then pass it along to google Maps http://code.google.com/apis/kml/documentation/whatiskml.html




回答2:


Nope you can't bypass that problem.What you can do is to maybe reduce the accuracy of the coords so that the url length gets reduced also.




回答3:


Google static image API does not support for viewing of KML file.




回答4:


Google recently changed the URL limit to 8192 characters in size.

You can see a feature request in public issue tracker that was marked as Fixed.

Also documentation confirms this change https://developers.google.com/maps/documentation/static-maps/intro#url-size-restriction



来源:https://stackoverflow.com/questions/4163652/google-maps-and-a-lot-of-path-points-long-polyline

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!