I have a large amount of data (thousands of polygons) that I want to share with people through my site. I want them to be able to view the polygons, and due to the large amount of data, I am not worried about them stealing this data through the displayed google map. However, since the kml file must be accessible to google, a proficient coder could discover the url of the kml files and simply download the entire file. Is there any way to restrict access to these kml files only to google so no outside people can get to them. I have tried .htaccess, but I can't figure out how to restrict access to everyone but google. Any ideas?
You could provide as a WMS layer in which case the end users will only have a picture of your data. And with 1000s of polygons it will be faster to download too.
Otherwise I don't think there is any way to display the KML on Google with out allowing general access to your data.
not a great solution but you could monitor the IP addresses used by Google calling back to your KML and then setup a frontend proxy to only allow those addresses access. Obviously, this list would need to be dynamic and constantly tended to but over time, you might find the block of IPs Google uses for KML Layer callbacks is fairly stable. It would also be great list to post back to this group :)
YMMV, cheers brian
allow access to 66.249.82.* and deny rest others for your kml file using any front end proxy servers or apache/nginx anything you use to serve kml files.
i check the $_SERVER["HTTP_USER_AGENT"] variable for google.
and if is correct i generate the kml from php.
$agent = "Kml-Google"; $google = strpos($_SERVER["HTTP_USER_AGENT"], $agent); ($google !== FALSE) or die; header('Content-Type: application/vnd.google-earth.kml+xml kml'); header('Content-Disposition: attachment; filename="otras.kml"'); ?> <?xml version="1.0" encoding="UTF-8"?> <kml xml ...