0

Is it possible in Carto to create a point via a simple query?

If I run: https://UserName.carto.com/api/v2/sql?format=GeoJSON&q=SELECT ST_MakePoint(-50.10, 42.31)

Encoded:

https://UserName.carto.com/api/v2/sqlformat=GeoJSON&q=SELECT%20ST_MakePoint(-50.10%2C%2042.31)

It returns the following error: {"error":["column \"the_geom\" does not exist"]}.

Is there a way to create a point via a URL call?

3

The error is telling you that the_geom column is missing, so you need to add it to your SQL query. In addition, I have used CARTO cdb_latlng function instead of ST_MakePoint because the first uses CARTO's default projection directly:

https://ramiroaznar.carto.com/api/v2/sql?q=SELECT+CDB_LatLng(-50.10,42.31)+as+the_geom&format=GeoJSON&filename=point

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.