0

I have a question on dynamic rendering with the CartoDB APIs. These APIs are new for me.

Data is a big layer stored in CartoDB (about 30 000 polygons).

In my application the default rendering of this layer must be replaced by a rendering defined by the user. For each subset of selected polygons per the user, the color change. But in a subset the number of polygons can be about 10 000 polygons for example.

In my code I use the subLayerOptions by setting SQL and cartocss properties. The SQL is like "sql:"SELECT * FROM polygons where ID in ('10000','40202'...".

It works fine with a few values but it doesn't work when the SQL request contains a lot value because the request is too long.

Is there an another method to do this?

1 Answer 1

1

In that case you need to do something in the server that group those polygons. Sending a SQL with 10k id's is going to be too large and it will take lot of time to send, process and render.

After you grouped in you could use another where condition like,

select * from polygons where type = 'whatever'

more information would be welcomed

3
  • At the end the web application must use a layer in cartodb and a internal database with statistics. The user choose one of these statistics, the application classifies this statictic and display a thematic map with a range colors. The color of the polygon depends on the classification define by the application. Is it possible to do that with cartodb APIs ?
    – cge
    Feb 10, 2015 at 8:51
  • In any case, your query should work if you are using cartodb.js, it uses POST when the request is too large for a GET. How are you using it? Feb 11, 2015 at 7:21
  • There was a bug in the cartodb.js fixed with the version 3.12.
    – cge
    Feb 16, 2015 at 14:44

Your Answer

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

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