Using the Googlemaps Geocoder and Storing the Data - google-maps-api-3

I am building an Events site in which the address of a given event will be stored to be used within a map on the page. Whilst viewing an Individual Events' page i would like to provide a list of similar events on side of the page. I would also like to rank this list by distance and display a small map with a marker on it for each item on the list.
I was thinking of Geocoding the Events address upon content input and then storing this data within the sites database. Doing this would allow me to calculate the distance of an event on the server and then provide an ordered list to display.
My question is this:
Would this violate the Googlemaps Terms of Service?
These terms:
"the geocoder for any purpose other than obtaining locations that will be displayed using the Google Maps APIs is a violation of the Terms of Service. You may use the HTTP geocoder to geocode addresses outside of your Google Maps API application so that they may be cached and later displayed using one of the Google Maps APIs, but locations obtained using the Geocoding Web Service may not be used by any other application, distributed by other means, or resold."
Suggest that storing the data is not a problem but i am unsure that the process of ordering the list by long lat would not result in a violation.
Any advice would be greatly appreciated.

As long as the map your refer to in your question is a Google Map and you are using the geocoded data to display features on a Google Map, you are fine. The client-side google.maps.Geocoderdev-guide is intended for dynamic requests that are based on real-time user interaction that drives a need to perform on-the-fly geocoding. But Google encourages you to consider using the Geocoding Web Servicedev-guide on the server-side, when you wish to pre-geocode static addresses or coordinates prior to using the response values on a Google Map. Storing those values is assumed.
It is common to perform some form of post-response/post-storage processing on those values, just like the ordering by distance that you describe, to fit whatever use case is needed to populate your map with the appropriate data. I understand you want to be careful to remain within the TOS, but what you describe sounds pretty standard.

Related

How to scraping/Extract data from ESRI Arcgis from website?

I was trying to extract data from an ESRI map embedded in a website. The objective would be by introducing geographic coordinates to be able to access the values ​​present on the map.
I leave here a print of the map and the respective address. I just cannot understand which method I should use since the map is embedded in the site. What processes should I use?
*for academic purposes
https://zonamentopf.portaldasfinancas.gov.pt/simulador/default.jsp
I must admit, I am not quite sure what you are after in terms of extracting data. I visited the site, and it is a pretty basic embedded web map created using the ArcGIS API for JavaScript, albeit wrapped in JSP. The web map is consuming some publicly accessible Esri services (World_Imagery, World_Boundaries_and_Places), and some non-public organizational services from www.portaldasfinancas.gov.pt.
It seems to me you are interested in geocoding. The pointer/marker on your map was looked up using Esri's ArcGIS Online Geocoding Service:
You have reached the home for the ArcGIS Online Geocoding Service. Use
it to turn addresses into coordinates, coordinates into addresses, or
to locate a point-of-interest.
If you are a developer, detailed documentation for using this service
in your application is available in the ArcGIS Online Geocoding
Service Help.
If you are an ArcGIS for Desktop user, you can use this service for
finding addresses interactively or geocoding a table of addresses.
Since I am not quite clear what you are trying to do, this is about all I can offer for now.
Note: Please respect data ownership. When in doubt, don't save a copy of someone else's data.
It sounds like you want to extract the polygon data in this map. The web app is making requests like this:
https://zonamentopf.portaldasfinancas.gov.pt/simulador/proxy.jsp?http://ags/arcgis/rest/services/SIMIMI/SIMIMI/MapServer/identify?f=json&tolerance=0&returnGeometry=false&imageDisplay=400%2C400%2C96&geometry=%7B%22x%22%3A-886651.3363331377%2C%22y%22%3A4443259.272690449%7D&geometryType=esriGeometryPoint&sr=102100&mapExtent=-887053.8250602124%2C4442583.282721534%2C-885178.7292100423%2C4443968.70385924&layers=all%3A0%2C1%2C2%2C3%2C4&callback=dojo.io.script.jsonp_dojoIoScript11._jsonpCallback
You can remove the callback parameter if you just want the data:
https://zonamentopf.portaldasfinancas.gov.pt/simulador/proxy.jsp?http://ags/arcgis/rest/services/SIMIMI/SIMIMI/MapServer/identify?f=json&tolerance=0&returnGeometry=false&imageDisplay=400%2C400%2C96&geometry=%7B%22x%22%3A-886651.3363331377%2C%22y%22%3A4443259.272690449%7D&geometryType=esriGeometryPoint&sr=102100&mapExtent=-887053.8250602124%2C4442583.282721534%2C-885178.7292100423%2C4443968.70385924&layers=all%3A0%2C1%2C2%2C3%2C4
However, if you just go to that link, you will get an error about a missing or incorrect referrer. To overcome that, you will need to add a header called Referer with value https://zonamentopf.portaldasfinancas.gov.pt/simulador/default.jsp. You can do that in a script or in an application like Postman, but you will not be able to do it in your own web app.
To view the available layers: https://zonamentopf.portaldasfinancas.gov.pt/simulador/proxy.jsp?http://ags/arcgis/rest/services/SIMIMI/SIMIMI/MapServer?f=json (with the Referer header I mentioned)
To view metadata about a single layer, use the following URL. Replace the 0 in /0/ with a different layer ID to get a different layer. https://zonamentopf.portaldasfinancas.gov.pt/simulador/proxy.jsp?http://ags/arcgis/rest/services/SIMIMI/SIMIMI/MapServer/0?f=json (with the Referer header I mentioned)
To query one of those layers to get the data, use the following URL to get everything, or add some query parameters if you want to filter the data. Replace the 0 in /0/ with a different layer ID to get a different layer. https://zonamentopf.portaldasfinancas.gov.pt/simulador/proxy.jsp?http://ags/arcgis/rest/services/SIMIMI/SIMIMI/MapServer/0/query?f=json&outFields=*&where=0%3D0 (with the Referer header I mentioned)
Related answer: https://stackoverflow.com/a/50213419/720773

Google geocode API results - storing the data

This is a question specifically for the Google Developer Relations team. I have read the Geocode API T&Cs and I am aware that I am not allowed to store data except by way of a temporary cache (e.g. for performance). Is this the end of the matter? I am developing a product which requires a search with results sorted by distance from a place, meaning that all my records need a lat/long. I was intending to use the Geocode API to get the lat/long when a user adds a record, and then adding that lat/long info to the record. We would then use the Haversine formula to calculate the relative distances and sort the results.
If I follow this approach, will I be in breach of the T&Cs? If so, is there another approach using the Geocode API which will allow me to hold onto lat/long data so that I can sort my results by distance, within the letter of the T&Cs?
For anyone else commenting, please observe the following restrictions: (1) we don't have a budget to buy a postcode-lat/long dataset; (2) we don't want to use a static dataset of our own, eg GeoNames, because we don't want to have to maintain data which is, effectively, public; (3) we have to support users who have javascript disabled.
To be absolutely clear, what I need here is to have the lat/long for all of my records in hand so that I can do effective searching and sorting by distance relative to another lat/long as provided, e.g. by a user searching.
Google Team, please respond to this message with contact details so we can speak.

Google Tracks geofencing & visualisation API

I am developing a node.js application which (amongst other things) will recieve location information from remote users and allow them to interact with each other via the server.
I'm using the Google Tracks API because I like the idea of being able to track users when appropriate, set up geofencing to define my coverage areas and to visualise what's happening.
The Google tracks API documentation is reasonable, however I'm not sure how I would go about actually visualising the entities and geofencing I have setup on a map - this is not something that I can find covered elsewhere.
Ideally I would be able to simply embed a map into a webpage which could link with my Tracks API account and show all of the fencing and entities. Another nice feature would be the ability to 'draw' a geofence, is there anything out there which would allow this?
Thanks :-)
Tracks API does not currently offer any kind of server-side rendering for your Tracks data, so the best approach is to use the API to retrieve the crumbs (or just current location) and render them using polylines (or just markers) in the Google Maps API. You can similarly get all your geofences and render them using polygons.
Because this is done clientside, you'll probably want to limit your data to a reasonable number (depending on the browser/OS combination, something like O(thousands) of vertices).
All this assumes that your app meets the terms of service of the Maps API so check those out as well.

ASP.NET/Silverlight Location Points on Google/Bing Map

I realize that the question is pretty complicated and may require much research. Hope anybody can help me to get useful resources to achieve my goal.
I want to have a Google or Bing map on my ASP.NET 4 application (C#) to display all my logged in users as points on the map.
I understand that this involves five major problems
Get the location of the device (most likely standard laptop with IE9 browser) based on its unique IP address.
Integrate Google or Bing map with ASP.NET or Silverlight application.
Display the right portion of the map with the right Zooming depending on logged-in users locations.
Finally, mark the addresses as points on the map.
Note that the locations points should be dynamically reflected when any of the locations is changed.
The database is implemented using SQL SERVER 2005/2008R2
There are geo location services that can give you the latitude and longitude given an ip address.
As you mention you would be storing these in a database, getting all the current users would be simple database call.
Integrating a google map into a html page is very simple. You would only have to emit the necessary javascript from your page.
You should mark the points on the map first.
Google maps api has calls to fit the map to show all current points(fitBounds). I am guessing bing would have something similar.
To reflect the current points, you would have to fresh your locations from the database. I highly recommend an ajax call that returns json and using that to replot the points.

Google Maps JavaScript API v3 Places Library Usage Limits

I have a site that associates Google Place information with users, and displays that information on a map. For instance, a user can search for a place (currently with the Places Library Autocomplete API) and bookmark this place for later retrieval.
As per the Google Maps TOS, I am only storing the Place ID and its reference in my database and am making client-side requests for the coordinate information of each place whenever I need to display them on a map.
I've recently encountered an issue where making more than 10 consecutive API requests for coordinate information (within a javascript loop) using the getDetails method on the service object returns an OVER_QUERY_LIMIT status code.
My question is this: if I am correct in assuming that storing the latitude and longitude of each place in my database violates Google's TOS, how can I programmatically retrieve the coordinate information for a number of places so that I can display these places on a map for a given user?
According to the terms - 10.1.3(b) -
(b) No Pre-Fetching, Caching, or Storage of Content. You must not pre-fetch, cache, or store any Content, except that you may store: (i) limited amounts of Content for the purpose of improving the performance of your Maps API Implementation if you do so temporarily, securely, and in a manner that does not permit use of the Content outside of the Service; and (ii) any content identifier or key that the Maps APIs Documentation specifically permits you to store. For example, you must not use the Content to create an independent database of "places" or other local listings information.
So if there are places getting queried a lot, you can temporarily store information on that place to increase performance.

Resources