I have a select query (really long) based on which I want to create a layer on google maps. I tried the same query in cartodbo map editor(online) it worked fine. But when I wrote a code to access the same data via javascript its failing with the error
http://myusername.cartodb.com/api/v1/map?stat_tag=API&lzma=3YCAiIBsXICAgICA...c3R1fHUC1tGnX6s9z1OH8TOP0X8G%2FnjsaKGG3A%3D%3D&callback=_cdbc_2758786579_1
here is my code
var mapOptions = {
zoom: 8,
center: new google.maps.LatLng(38.328732,-85.764771),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('map'), mapOptions);
cartodb.createLayer(map, {
user_name: 'myusername',
type: 'cartodb',
sublayers: [{
sql: "SELECT * FROM cartodb1 where zcta5ce10 in (" + zipList + ")",
cartocss: '#cartodb1 {polygon-fill: #FF6600;polygon-opacity: 0.7;line-color: #FFF;line-width: 0.5;line-opacity: 1;}'}]
})
.addTo(map) // add the layer to our map which already contains 1 sublayer
.done(function(layer) {
console.log('Fine');
})
.error(function(e) {
console.log(e);
});
}
where zip list is quite huge so I posted it separately here http://textuploader.com/ase80
1 Answer 1
Ok found the solution! Was using older version of cartodb. As per @cge comments in Dynamic rendering on a layer with a long SQL query
-
tag your question as answered, pleaseJorge Sanz– Jorge Sanz2015年07月20日 07:59:51 +00:00Commented Jul 20, 2015 at 7:59