开发者

Pre-Load Points into Google Map API

I'm creating a google map with about 200,000 points. It takes a while to load the points into the API and then browsing is sluggish.

开发者_开发百科

If not, can someone suggest a better way then this:

I load the points as Lat & Long segments into flightPlanCoordinates and then map them with this code:

var flightPath = new google.maps.Polyline({
  path: flightPlanCoordinates,
  strokeColor: "#FF0000",
  strokeOpacity: 1.0,
  strokeWeight: 2
});

Is there any way to save the state of a google map you can just reload it without all the processing?


Browsers have gotten significantly better at handling this over the last few years, but once you hit a few thousand points you're probably better off starting to consider rending your data as image tiles instead of vectors within the browser (although projects like polymaps and others show a lot of promise with complex vector data).

One solution in the context of the Google Maps API (v3) is to create a KML and use a KmlLayer, or else put your data in Google Fusion Tables and use the FusionTablesLayer. Either way, your polygons will be rendered by Google's servers as image tiles and place negligible overhead on the browser relative to your current scheme.


Making a map with 200,000 points is not a good idea; you should use fewer points.

It sounds like you're displaying a detailed flight path; you should merge all points within a mile or so to reduce the total number.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜