1

I am new to GIS systems and am beginning with CartoDB. I have extracted polygon data from Open Street Map which I have uploaded and added as a dataset. The data shows building footprints but these seem to disappear into another poloygon(?) which shows the broader site boundaries; in essence everything is highlighted bar the roads when what I actually want is only the building footprints highlighted.

Anyway, in the table I have a lot of rows where the value in the building column is null. When I use the filter to switch this off, I achieve what i need. However, this is only possible when viewing the list layout (I just switch off null) because for city size data it says too much data to view as a list so I have to search to filter if that makes sense and I'm not sure how to switch it off this way?

I have also tried a basic SQL query on the table which did not seem to work:

SELECT * FROM map_table;
DELETE FROM map_table WHERE building = "null";

I'm new to programming so probably making some basic errors but if someone could shed some light or point me in the right direction?

1 Answer 1

1

There are two basic ways to achieve what you're trying to do. The first is using the filters like you already tried. This filters out the data by producing a SQL query in the SQL tray and then running it against your data set. It should look something like this:

SELECT * FROM map_table WHERE building is null

It's perfectly acceptable to keep this query there while building your map.

If you want to delete that data from your dataset, first make a copy of your data.

Next, you can run the following query against your table to delete the buildings:

DELETE FROM map_table WHERE building is null

This will remove the rows from your data table permanently--there's no undo button with this operation.

You can checkout some more on the basics of SQL and PostGIS, the querying languages behind CartoDB's data mapping, at CartoDB's Map Academy. There are a couple of lessons on SQL/PostGIS.

1
  • Thank you. The SQL query solved the issue. I had my syntax wrong, understanding null as a value and using "building = null" as opposed to "building is null". Thanks Sep 27, 2015 at 23:36

Your Answer

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

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