Skip to main content
added 299 characters in body
Source Link
Jorge Sanz
  • 2.6k
  • 1
  • 16
  • 21

Two things here checking on your fiddle. First is that for some reason HTTPS force is not working so if you check your dev tools you'll see the browser is blockingare putting the call tohttps:true option in the Maps API. Ifwrong place, you load the same fiddle using HTTP then the callneed to add it to the Maps API worksnext parameter. In normal JS it would be like this:

      cartodb.createLayer(map, {
        user_name: 'user',
        filter: "mapnik",
        type: 'cartodb',
        sublayers: [{
          sql: layer_sql,
          cartocss: layer_cartocss,
          interactivity: 'cartodb_id, name, field1,field2'
        }]
      }, {
        https:true // here!
      })

The second error is that your tables are not public. You'll see a response of the Maps API like this on your console

Postgis Plugin: ERROR: permission denied for relation t7189c8441479760839c8fe7ebc3fbe5d_6d6d454828c05e8ceea03c99cc5f5...

In order to create layers with the Maps API on the fly your datasets need to have their privacy set to Public or Link, otherwise you need to use Named Maps and some kind of middleware to generate templates on the fly.

Two things here checking on your fiddle. First is that for some reason HTTPS force is not working so if you check your dev tools you'll see the browser is blocking the call to the Maps API. If you load the same fiddle using HTTP then the call to the Maps API works.

The second error is that your tables are not public. You'll see a response of the Maps API like this on your console

Postgis Plugin: ERROR: permission denied for relation t7189c8441479760839c8fe7ebc3fbe5d_6d6d454828c05e8ceea03c99cc5f5...

In order to create layers with the Maps API on the fly your datasets need to have their privacy set to Public or Link, otherwise you need to use Named Maps and some kind of middleware to generate templates on the fly.

Two things here checking on your fiddle. First is you are putting the https:true option in the wrong place, you need to add it to the next parameter. In normal JS it would be like this:

      cartodb.createLayer(map, {
        user_name: 'user',
        filter: "mapnik",
        type: 'cartodb',
        sublayers: [{
          sql: layer_sql,
          cartocss: layer_cartocss,
          interactivity: 'cartodb_id, name, field1,field2'
        }]
      }, {
        https:true // here!
      })

The second error is that your tables are not public. You'll see a response of the Maps API like this on your console

Postgis Plugin: ERROR: permission denied for relation t7189c8441479760839c8fe7ebc3fbe5d_6d6d454828c05e8ceea03c99cc5f5...

In order to create layers with the Maps API on the fly your datasets need to have their privacy set to Public or Link, otherwise you need to use Named Maps and some kind of middleware to generate templates on the fly.

Source Link
Jorge Sanz
  • 2.6k
  • 1
  • 16
  • 21

Two things here checking on your fiddle. First is that for some reason HTTPS force is not working so if you check your dev tools you'll see the browser is blocking the call to the Maps API. If you load the same fiddle using HTTP then the call to the Maps API works.

The second error is that your tables are not public. You'll see a response of the Maps API like this on your console

Postgis Plugin: ERROR: permission denied for relation t7189c8441479760839c8fe7ebc3fbe5d_6d6d454828c05e8ceea03c99cc5f5...

In order to create layers with the Maps API on the fly your datasets need to have their privacy set to Public or Link, otherwise you need to use Named Maps and some kind of middleware to generate templates on the fly.