Accessing public data (no authentication)
There's an ever-growing number of public datasets available in Google Maps Engine for use by developers in their map or data visualization applications. You may retrieve this data with a simple HTTP request; no authorization is required, and authentication is accomplished through the use of an APIs Console key.
A sample request is below:
https://www.googleapis.com/mapsengine/v1/tables/12421761926155747447-06672618218968397709/features ?version=published &key=AIzaSyAzgdOiFagRujMB4kr-vyRTbPw3V6d1bWw
The following sections describe each portion of the request.
Before you begin
Before you can make any requests to the Google Maps Engine API, you must activate the API in the Google APIs Console, and create an API key.
Follow the instructions in the Registering Your Application page of the Google Maps Engine API documentation, then return to this page.
Alternatively, you can try to do this tutorial, which will take you through the steps on how to begin using the Google Maps Engine API (including obtaining an API key) and how to access public data. It also covers how to create and access private data.
Making your data public
To make a vector table publicly accessible, log in to your Google Maps Engine account. Google Maps Engine uses access lists to define the type of access, and the people who are granted that access, to maps, layers, and data sources.
If you don't have an access list that is configured as Public on the web, you'll need to create one. Refer to Making data public in the Google Maps Engine help center for instructions.
Then, navigate to your layer and select your public access list in the API access drop-down list.
The URL for public vector table requests is:
Required URL parameters are:
version=published: This indicates that you're accessing the publicly-accessible version of the table in Google Maps Engine.
key: The value of the
keyparameter must be a valid APIs Console key. For instructions on finding your key, read Registering Your Application.
Optional parameters are:
limit: Defines an upper bound on the number of features to return.
maxResults: Defines an upper bound on the number of features to return per results page. If more results match the request, a
nextPageTokenis included in the response. The request can be repeated with the
nextPageTokenas the value of a
pageTokenparameter to retrieve additional results.
orderBy: Determines the order in which features are returned. See the orderBy parameter section for details.
pageToken: Accepts the value of a previous request's
nextPageTokenfield. Used to page through results.
select: Defines the columns to include in the response. See the select parameter section for details.
where: Allows SQL-like logic to be applied to the data. See the where parameter section for details.
https://www.googleapis.com/mapsengine/v1/tables/12421761926155747447-06672618218968397709/features ?version=published &key=AIzaSyAzgdOiFagRujMB4kr-vyRTbPw3V6d1bWw &limit=100 &maxResults=50 &orderBy=LENGTH &pageToken=CGQSE0VnTXhPRGtZaHQ3dTJZNkl0d0k &select=LENGTH &where=LENGTH<0.1
When requesting a list of features in a table, you may specify an
value that determines the order in which features are returned.
GET https://www.googleapis.com/mapsengine/v1/tables/tableId/features ?select=ST_DISTANCE(location,ST_POINT(1,2)) AS distance orderBy=distance DESC &limit=50
The following rules apply to ordering:
- Only one order key is supported.
The key must be defined in the SELECT clause. You may assign values to a temporary column alias (in this case
select=ST_DISTANCE(location,ST_POINT(1,2)) AS distance &orderBy=distance
Or you may select an existing column in the table:
- The sort order is stable. Features with identical keys are sorted by
Sorting defaults to ascending order. You may append
orderByclause to specify an order.
When including an
orderByparameter, you must also include a
limitparameter, whose value is less than or equal to 75.
Defines the columns to include in the response. The
select parameter accepts
You may also use a supported geometry function and a column alias:
select="opening hours",ST_DISTANCE(location,ST_POINT(1,2)) AS distance
The response includes only the specified properties, in the same order as they are specified.
When using the
select parameter, note the following:
- Property names are case-sensitive.
- The request must not specify duplicate or non-existent properties.
- Property names starting with a letter or an underscore, and followed by
letters, numbers, and/or underscores ONLY do not need to be enclosed in
quotation marks (e.g.
- All other property names must be enclosed in quotation marks (e.g.
select="Property One"). Single quotes are not supported.
- If a property name includes quotation marks or backslashes, these must be
escaped with a backslash (e.g.
- The geometry property that occurs first in the list will be shown in the
geometryfield of the GeoJSON output.
- If there are no geometry properties in the list, the
geometryfield will be null.
The Google Maps Engine API supports a limited SQL-like query language for
requesting table features. A SQL-like predicate can be passed as the value
where parameter, as follows:
The predicate must include a column name from the specified table (
agein the example above) and a supported operator:
>, <, >=, <=, =, <>
Predicates can be joined with AND and/or OR (note that AND has precedence over OR):
where=age>10 AND income<=50000
You may use a supported geometry function:
where=ST_DISTANCE(location,ST_POINT(1.23,4.56)) > 100
As with all parts of a request URL, predicates must be URL-encoded:
Examples in this documentation are not encoded, for ease of reading.