How to obfuscate data when using Google Maps?

You can store your data in a database (Fusion Tables is a quick solution).

Google Maps has a tutorial that shows you how to do this with MySQL (but can be any database) http://code.google.com/apis/maps/articles/phpsqlajax_v3.html

You can get as secure and obfuscated as you want using a database back-end.

Looks like you geocode your data on the fly - you will be limited to 1000 request a day per IP address.

Would be more efficient to geocode and then update the database near-realtime.


You won't be able to actually hide the contents of popup_content and address from the user, simply because anything that is sent to a web page is plainly visible to the end-user. Instead of dumping it all at load-time though, you can do an async request for it on a map click. In your click handler function you would want to make a request from the PHP page for popup_content[i], and open the infoWindow once the request completes (alternately, open the infoWindow right away with Loading... text, and update the text afterwards). You can handle addresses in a similar fashion.

Note: this solution still does NOT hide the content from the user, it simply delays the loading so that all of the data isn't immediately present. It also will have a negative impact on your performance.

As another alternative, you could obfuscate the data in some way. You can also output the data to a separate JavaScript file on load, that way it isn't immediately visible when the user clicks View Source. Again, the data isn't actually hidden from the user; it is simply removed from plain sight.