I've been working on a google map (v3 of the api) that is plotting 120 markers or so (or will do shortly). If you view the source the map data is for all the see, is it possible to hide this?
I'm not worried about the code that is generating the map, just the data. The data is grabbed from a Wordpress cms.
I think your options mostly boil down to:
Obfuscate the data. Restructure it in such a way that it is difficult to recognize as location data, and inconvenient for other people to work with.
Don't include the data directly in the page body. Fetch it using an AJAX request instead. Determined users will still be able to get the data, but it won't be quite as easy/obvious, and it will not appear when doing a 'view source'.
You could of course combine the two approaches, and have an AJAX request that returns obfuscated data.
Although, your data appears to be names and locations of businesses, so I'm not sure why protecting it is a concern. Presumably any interested party could find the same information in a phone-book (or with a Google search) if they were so inclined.
Related
TLDR: I want this, but I am happy to send the data in my database to google as it is created (any user can create a location on the map).
I need to create a lot of map markers on a google map for a website I am creating. Insertions and deletions will be required, but I will never need to filter the data. I found several links showing how to create this map to make it accessible through the use of google docs' spreadsheet, however I have a database of latitude/longitude coordinates in google app engine. My preferred method would be for google to host the map and me to send insertion / deletion queries to the map itself (as the map is constant for all users). This sounded exactly like fusion tables, but I couldn't actually find out how to do it programatically in fusion tables
I know how to create individual points on a map, but there will be a lot of points so sending every single point to the client will be way too slow. My backup plan is simply to use a quad tree and get the client to send the server the bounds of the map and reply with everything in there, but I suspect google has a better solution.
Depending upon the size of your data set and how many insertions and deletions you need to make each day, you might want to consider using the Fusion Tables API. You can do a "replaceRows" operation to swap out the entire table contents, or individual "insert" and "delete" calls. (Of course then your data is stored in Fusion Tables.)
You can then embed your map in the website of your choice, or even host it on Google Drive.
What I need is the following.
Whenever I add any instance of object in my website, I need the server to add the location of the object to my own map either in Google maps or Bing maps (Bing maps docs are more clear therefore I'm going to use Bing).
Later, whenever I view the object in my site, the map should point to the location of the object and other my map objects in the same map.
How can this be achieved? Do I need to hold all the coordinates and object descriptions in my server, or somehow it is saved in the google or bing.
I went through the docs, but couldn't find any information I need.
You need to store them on your server and load them into the map on your webpage. There are ways with both google (fusion tables) and bing (spatial data services) of storing them with the provider but if you are already storing a copy for your website you are better off keeping them there for the map rather than maintaining two copies.
I'm not sure how technical you are but this best architecture approach is this:
1) Write a database query that finds objects to show on your map, ideally filtered by whatever the user can use to filter objects elsewhere on your site. Add to this query a filter by geographical bounding box (the range of latitude and longitude that can be seen on your map at any one point). The bounding box filter is just a simple sql BETWEEN clause but will mean you dont have to load every single object on to the map.
2) write a "webservice" that uses the database query in 1) and turns the results into JSON. This approach will lead to a much cleaner seperation between your mapping code in javascript and your server side code in the webservice.
3) Write your mapping frontend in Bing using javascript and use something like Jquery to read data from the webservice as the map is moved around re-load data that know should be shown on the new map view. As the data will be in JSON its much easier as JSON will just give you javascript versions of your objects
I know there's a very similar question about this, but the problem is still unresolved and seems like such a trivial thing one may want: for a given Google Map, with data coming from a Fusion Tables layer, I'd want to open all InfoWindows (tooltips) simultaneously.
Currently, you can open them individually by clicking each region on the map. The desired result would be like clicking them all while they stick around (not letting them close each other).
My goal is to show the map with all this information visible, not needing any interaction. I'm not aware of an easier way of showing labels in Google Maps, but I'd be delighted to hear another ways to approach it. At this point, I'd settle for not letting each InfoWindow close the rest, so then I could manually open them one after another.
There's not a direct way to do this as the FusionTableLayer doesn't expose the underlying structure of the data until you click on a feature.
Depending on the number of rows in the table, you could use Google Chart Tools to load the table directly, up to 500 rows, and generate your own infowindows based on the data returned. That is easy for point data, not as easy for polygons or polylines as you have to determine where to place the infowindow. And if you table uses geocoded data you will have to re-geocode them. If it uses KML you will have to parse the individual KML features in each row to determine where to place the infowindow.
So, it's doable but not super easy.
I am attempting to create an application that will allow a small group of users to subscribe" to a KML feed we produce. The users want to view the KML using Google Earth on their mobile devices which does not support "network links" (please add this...).
The KML contains several hundred different place marks with related information as wells about 30-40 polygons. I am using the HTTP protocol. So far, I can successfully perform the ClientLogin and get the authorization token, I can retrieve a list of user maps and find the one I am supposed to update. Now I'm stuck. Every single feature needs to be updated every time...I don't want to have to manually update every feature or delete each one and re-add. What I would really like is to just provide a KML document and tell it to just
replace ALL content in this map with this KML.....is this possible?
Summary:
Login, then...
Find a map with a specific name, then...
Replace that maps content with a KML file
I thought of just deleting the map and creating a new one with the
same name, but that might mess up the UI of the mobile device and
force the user to have to re-select the map every time I update them (every day). This is not completely out of the question, but it's certainly not ideal.
What is the best way to handle this?
Good question. I don't think the HTTP protocol allows for this in the way you suggested (login, find map, replace entire map with KML).
The delete and recreate method that you suggested in your comment might work, but you'll have to wait until issue 2590 is fixed to resolve the 400 BAD REQUEST problem. The workaround that Google suggest for this issue is to upload individual KML features as required, which really won't help you as that's exactly what you're trying to avoid!
See my answer on this similar question for more details.
I'm losing some hair over Google's AJAX API currently. What I do is turning structured location data into a Google local search API query in order to give users an alternative result list of places.
ex.:
http://ajax.googleapis.com/ajax/services/search/local?v=1.0&key=XXX&hl=en_US&mrt=localonly&rsz=large&q=pizza+Neustadt+DE
However, the API behaves very oddly at times, often not taking into account certain parameters I pass to it. For instance:
If I search for "term Rome Roma IT" on Google Maps, then it finds all terms in Rome as expected. If I repeat the same search on the API, I get zero results (I have to remove either 'Roma' or 'Rome' for it to work -- Roma is the administrative region here, and Rome the city name).
Why is that?
Another example. There is like 20 different towns, cities and boroughs called Neustadt in Germany. Now, when I search on Google Maps, it only finds one, unless I specify an additional qualifier, like a region or something.
Now, on the API level I kinda expected that when passing lat/lon parameters along with a query for Neustadt then it would be clever enough to pick the correct Neustadt by looking at the geo coding. But that doesn't happen, it always picks the same Neustadt and ignores the geo data.
q=pizza+Neustadt+DE&sll=48.8053,11.7579
I had similar problems when doing bounding box searches. The bounding box seems to be ignored completely, since I'm still getting result data which is a hundred kilometers off:
q=pizza+Neustadt+DE&sll=48.8053,11.7579&sspn=0.00001,0.00001
The last result is not even in the same city; shouldn't the tiny bounding box not result in any data whatsoever? I could even pass a zero size BBox and I would still get results.
I know there's an actually quite extensive documentation for the Local Search API, but it never goes into detail about which parameters are used when and how a query has to be structured and is evaluated, which makes it very difficult to get decent results.
Do you have any hints, tipps, suggestions on how to get to grips with Google Local search?
UPDATE:
I just found something REALLY odd. Could someone please go to this website:
http://code.google.com/apis/ajaxsearch/documentation/localsearch/index.html
open firebug, and monitor the HTTP traffic when typing in this search query:
test Rome Roma IT
You will get a bunch of results on the map. Now copy the URL that was contacted via AJAX and send a request to it on the command line:
curl "http://www.google.com/uds/GlocalSearch?key=internal-sample&v=1.0&rsz=large&sll=41.97684819454683%2C12.486648559570312&sspn=0.204185%2C0.549316&q=test%20Rome%20Roma%20IT&lssrc=lsc&lscstyle=final&start=0&callback=_callbacks_._5g139yfuc"
Now I get ZERO results. How can that possibly be? It's definitely not the key or callback args, I removed them without any change to the outcome of that query.
Is Google extending their search results when a query comes from one of their servers?
I've encountered exactly this same problem and it seems to be down to a combination of licensing issues and the fact that what Google exposes via its APIs and what it displays in the Maps/Google search pages are a combination of different searches (search, maps, base, data etc.etc.)
On the licensing issue, it seems that Google can display more information when a user goes via the browser, compared to requests via API calls (which could theoretically be automated).
See here for example.