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?

nmtoken
13.6k5 gold badges39 silver badges91 bronze badges
asked Feb 9, 2015 at 17:32

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

answered Feb 9, 2015 at 18:27
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 ? Commented 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? Commented Feb 11, 2015 at 7:21
  • There was a bug in the cartodb.js fixed with the version 3.12. Commented Feb 16, 2015 at 14:44

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.