0

I am executing this query with cartodb.js. I am moving the markers randomly to generate a new layer.

  cartodb.createLayer(map, {
      user_name: 'mickemr',
      type: 'cartodb',
      sublayers: [{
        sql: "SELECT  cartodb_id, user_email,  apo_about_me,apo_headshot_url,apo_member_number, first_name, user_nicename,  ST_Transform(ST_Project(the_geom, 300*random(), random()*(3*pi()/2))::geometry , 3857) AS the_geom_webmercator   FROM users",
        cartocss: "#users  {marker-fill: red;marker-width:20px; } "}]
    }) 

My problem is that the tiles generated are not created properly, they are cut in the middle: Tile: http://screencast.com/t/5WFESgZkrG3 Chunk of map: http://screencast.com/t/g7RVmIujvye

If I don't use the random function it is working properly.

Anybody know what could be happening?

Is the SQL query wrong?

2

The tiles are independently rendered, so each tile is using different random numbers, hence parts of the points end up in different places. That's a correct diagnosis, but unfortunately I don't know that I have the cure.

  • I was trying to move the markers from the real position (the markers are sales angents) for privacy reasons. Do you know another solution to move randomly these markes in cartodb or away to protect their privacy while showing them in the map? Thanks – ekaitht27 Jun 4 '15 at 20:17
  • 2
    You could move the points in the data itself so that you just show the anonymized data instead of creating it on runtime – iriberri Jun 4 '15 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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