开发者

google map V3 - private kml feed

I am trying to switch from virtual (VE) earth to google map (GM).

It is pretty easy to overlay a georss feed over a map in VE as well as in GM:

var georssLayer = new开发者_如何学运维 google.maps.KmlLayer('www.bla.com/kmls/k1');
georssLayer.setMap(map);

Unfortunately, google requires the 'kml address' to be public. What can I do to achieve the same functionality if my address is not public (e.g. when the user has to login before [s]he can enjoy the map)?

Thanks.

Christian


I've thought about this issue before and this is the solution I've come up with (although I haven't implemented it yet).

  • The server code that generates the html page in which the map is embedded should generate a temporary token that is tied to the current user in the database.
  • Make the KML address public, but pass the temporary token to it as a query parameter
  • Include logic in the KML server code that checks the passed token to be sure it is valid
  • The token should only be valid for a limited time.

This solution will be slightly less secure than full id/pw authentication on the KML resource. But by using a short lived token, it may be good enough, depending on your requirements.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜