0

I try to use CartoDB (https://carto.com/). I created a layer with geojson file, but if the file is updated, how can I replace existing layer's data by new geojson?

I know, creating new layer and load new geojson, copying all styles and template settings from old layer to new and deleting old layer, is exactly same with replacing data. But, "copying all styles and template settings from old layer to new" is very complicated task, so I want to replace just data only...

Do anyone know about how to do this?

0

If I understood you correctly, you have a map with a layer, and you want to replace the data of the current layer for data from a different dataset.

You can do this by going to the SQL tab of the layer in the map (in the right sided menu) and change the default query that calls the data in the layer:

SELECT * FROM tableA

And replace it for:

SELECT * FROM tableB

The data of tableB must be similar to data of tableA so there won't be problems in the styles.

  • Thank you, I can do it something like this: 1. Import new geojson to temp_table. 2. Run Query: DELETE FROM main_table; INSERT INTO main_table (cartodb_id, the_geom, attributes) SELECT cartodb_id, the_geom, attributes FROM tmp_table; – kochizufan Oct 6 '16 at 15:30

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.