0

How can I see in Carto the density of data points geolocalized if some of them are located in the same coordinates? In an example:

If I have 5 coordinates as follows:

50.64815,12.96872     
48.65920,8.94052    
48.65920,8.94052   
48.65920,8.94052   
48.65920,8.94052

In Carto I will be able to see 2 datapoints (because four coordinates are the same). However, the dimension of these 2 datapoints are displayed with exactly the same dimension.

I'd expect to see a map showing these 2 datapoints but one 4 times bigger than the other.

Any advice?

1

You can build a query, group by coordinates and count data points.

select count (*), x, y from table group by x, y

Or use directly the geometry column

select count (*), the_geom from table group by then geometry

If you want the number of points as 3rd dimension in your coordinate query like this

Select st_makepoint (x, y, count (*)) from table group by x, y

To transform to Web mecator add another function

Select st_transform (st_makepoint (x, y, count (*)),3857) from table group by x, y

Make sure the column names match your table.

1

Follow these steps to make a bubble map (or graduated symbols map) based on the number of points per location:

1-First, import your file as a csv, xlsx or another supported format into CARTO. I recommend naming your coordiantes columns like lat/latitude and long/longitude. In doing so, the importer will recognize them and will geocode them.
2-Secondly, apply a query similar as the one @Thomas suggested:

SELECT
  min(cartodb_id) as cartodb_id,
  the_geom,
  the_geom_webmercator,
  count(*) as number_points
FROM
  table_name
GROUP BY
  2,3

Or you can use Find centroids from geometries as explained in the 2nd part of this guide, selecting the_geom as category.
3-Third, you can create a map from the query ("on the fly") or create a new dataset from it (and create a map afterwards).
4-In BUILDER, go to STYLE and style the marker-width by value (as explained in this guide), selecting number_points.

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.