0

Why doesn't this example work? http://dev.openlayers.org/releases/OpenLayers-2.12/examples/fusiontables.html I would like to do something similar but i can not find any other example how to display points from Google Fusion Table on the OpenLayers map?

1 Answer 1

1

The error message on console is:

Access Not Configured.
Please use Google Developers Console to activate the API for your project.

At bottom of example page on openlayers.org posted in question you can see this text:

View the fusiontables.js source to see how this is done. 
You will need to get your own apikey from Google's API Console for this to 
function on your domain.

Please see this link to setup Google's API Console

EDIT: An example post request

https://www.googleapis.com/fusiontables/v1/query?sql=%22select+*+from+1g5DrXcdotCiO_yffkdW0zhuJk0a1i80SPvERHI8%22&key={YOUR_API_KEY}

The above from Google API console gives:

{
"kind": "fusiontables#sqlresponse",
"columns": [
"Route",
"Reverse",
"Times Flown",
"Line String",
"DepAirport",
"ArrAirport",
"First Time",
"Last Time",
"Distance",
"Time",
"Route Airline List",
"Route Year List"
],
"rows": [
[
"CLT-MSP",
"",
"2",
{
"geometry": {
"type": "LineString",
"coordinates": [
[
-80.943139,
35.214,
0
],
[
-81.2867027228329,
35.5424123906216,
0
],
[
-81.6334656409202,
35.8701977680468,
0
.....
..

And Openlayers can take it from here.

7
  • I'm a little bit lost. I have a code as follows: layers: [ new OpenLayers.Layer.OSM(), new OpenLayers.Layer.Vector("Vectors", { projection: new OpenLayers.Projection("EPSG:4326"), strategies: [new OpenLayers.Strategy.Fixed()], protocol: new OpenLayers.Protocol.Script({ url: "https://www.google.com/fusiontables/api/query", params: {sql: "select * from 1g5DrXcdotCiO_yffkdW0zhuJk0a1i80SPvERHI8"}, format: new OpenLayers.Format.GeoJSON({... and where do I put my own apikey from Google's API Console
    – bucek
    Jun 10, 2014 at 14:18
  • this is my example: link, and demolayer4 should be from Google Fusion Table
    – bucek
    Jun 10, 2014 at 14:23
  • Did you registered on Google's API console? and first try the example hosted on openlayers
    – rkm
    Jun 10, 2014 at 14:48
  • now i have API key. should i put iy in my html file?
    – bucek
    Jun 11, 2014 at 6:07
  • select * from YOURAPIKEY
    – rkm
    Jun 11, 2014 at 7:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.