Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Hot answers tagged

12

This sort of finding comes up fairly often, and it is a bit obscure, so is worth restating. If you define a geometry within a function that uses it, such as ST_Intersects or && (which ST_Intersects uses under the hood), then the query planner chooses a full table scan, as "it" has no knowledge of the outcome of the geometry creation function, ie, ...


11

The ST_GeomFromGeoJSON really only expects to be fed the geometry portion of the object, so this works: select st_astext(st_geomfromgeojson( '{"type": "Point", "coordinates": [-71.11295700073242,42.37896312335581]}' )); So you'd want something more like this in your JS: var drawing = "'"+JSON.stringify(layer.toGeoJSON().geometry)+"'";


11

DISCLAIMER: I work at CARTO as Support Team manager and Solutions Engineer CARTO Open Source is equal in functionality to an Enterprise paid account, but apart from having to install (and more important, maintain) your own installation, there are differences in a few services. Routing, geocoding, and any other Location Based Service on a paid account come ...


10

I'm assuming that your input lat-long are based on the WGS84 datum. Making a point geometry under this assumption is as easy as using the ST_MakePoint() function: The problem with ST_MakePoint() is that the geometry that is created does not not have a spatial reference. We can set the spatial reference by using the ST_SetSRID() function. So the simplest ...


10

CartoDB can definitely handle a dataset that large, including filtering, infowindows, and multiple different versions of the map (i.e. styles and selected filters) using the same dataset. This, for example, is around 100mb of polygon data being styled on the fly with each click of the little menu, http://bl.ocks.org/andrewxhill/raw/8324313/ You can find ...


8

You have to explicitly specify a width and height to your #map container : In css add : #map { width:600px; height:400px; } Or in HTML : <div id="map" style="width:600px; height:400px;"> And you will see correctly your map!


8

When looking at a public map or table in CartoDB, if you copy the URL and share it with someone else, they will be redirected to this /public/map version. Here they can view but not edit. They can also download like you say. If you want to add download links to your own websites, it is also possible to create direct links in your HTML to any of the file ...


8

This is a cool tool that lets you check out different basemap providers and gives you the references to the tiles for your code. It's based on leaflet but could still be helpful to you. leaflet basemap provider demo


8

There is simple query for this case. SELECT a.id AS store,count(b.*) AS customer_count FROM stores a, customers b WHERE ST_DWithin(a.geom::geography,b.geom::geography,5000) GROUP BY a.id I have stored my sample data in the projection WGS 84 (4326). When you want to use a metric system, you have to convert the geometries to geography format. The ...


7

You can do it via the geography type, using a geography index, or via the geometry type with some math to adjust for distortions in mercator. With geography: CREATE INDEX gb1900_geog_idx ON gb1900 USING GIST (geography(the_geom)); CREATE TABLE newtable AS WITH c AS ( SELECT a.cartodb_id, count(*) FROM gb1900 a, gb1900 b WHERE ST_DWithin(...


7

If your problem is about exporting data from CARTO. On the one hand, you can export your datasets as GeoJSON, csv, shapefile, KML or SVG using CARTO UI or CARTO SQL API. On the other, you can export your maps as CARTO files. CARTO files are basically a zip with two files: a GeoPackage and a JSON, containing the vizjson configuration. You can unzip it and ...


6

This functionality is already available in the authoring tool. You need to be a subscriber of the Coronelli plan at least. You have the details in the pricing page, and a blog post explaining the feature. Another way of protecting your data is using our APIs and creating a proxy in your app (here is one done in node.js)


6

The number of layers in a CartoDB visualization is set according to your account. I'm not sure if there is a way to work around that with html. With free accounts the limit is 4, with larger accounts you can request to have your account configured for more layers.


6

CartoDB does use timestamp for the columns. So when a conversion doesn't work for you through the UI, you can use a bit of SQL to do it for you. In your case I would, 1) Create a new column called, my_time (or whatever you want) 2) Use a SQL statement to convert write the timestamp formatted strings to your new column UPDATE table_name SET my_time = ...


6

It's not possible to change SQL or CartoCSS of a visualization with private data. The reason is pretty clear: if we allow to change SQL any user could read somehow your data. So to cover your use case we introduced the concept of template maps. That allow you to create maps with hidden sql and cartocss but with some configurable parameters. Basically it ...


6

Maybe you could use Osmbuildings. Its a JavaScript library for visualizing OpenStreetMaps (or custom GeoJSON) building geometry into a 3D perspective. It use OpenStreetMaps data directly. Just add the loadData() method: var map = new L.Map('map').setView([52.50440, 13.33522], 17); var osmb = new OSMBuildings(map).loadData(); L.control.layers({}, { ...


6

Writing data through the API is pretty simple. Here is the most basic, Suppose we have two variables already, how you get them is up to you, username = 'cartodb-user-name' apikey = 'MY-CARTODB-API-KEY' Next, lets create an INSERT statement to use insert = "INSERT INTO my_table_name (the_geom, measure) VALUES (CDB_LatLng(43, -120), 22.0)" Create the URL ...


6

Follow these steps: Download a us counties shapefile. Here's one that will work. Import the zipped UScounties file into CartoDB as a new table. Change the fips column's data type to number. (click on the word 'string' right below 'fips' and select number). Click the merge tables button on the right side of the tool bar when you are in data view. Choose '...


6

We use a trick like: <style type="cartocss/text" id="simple"> #earthquakes_cdbjs_lesson3{ marker-fill: #FF6600; marker-allow-overlap: true; ... } </style> and after that cartocss: $("#simple").text();


6

Yep, it is totally possible! Here are two examples with the same dataset, one is for changing intensity over time, https://team.cartodb.com/u/andrew/viz/32ff4f28-7e51-11e4-9555-0e853d047bba/public_map The second is more like you request (I think) and shows cumulative amount over time http://team.cartodb.com/u/andrew/viz/a0a551a0-9b41-11e4-856f-...


6

To create/instantiate a Named Map and obtain an image from it you don't need Javascript or a Browser. The MapConfig file in which you define your layer allows you to add HTTP layers which are mostly meant to include your own basemaps directly. Here's an example of the definition of the layers of a map (my basemap included, note about the credential tokens ...


6

You and your friend are using different versions of CARTO. While your friend is on the older UI, CARTO Editor, you're using the newer CARTO Builder. In CARTO Builder, dataset merges or joins are not performed in the Dataset View, like in the older CARTO Editor, but in the Map View as an Analysis. Here's a GIF showing the steps to perform such a join. ...


6

CartoDB is looking for all extensions included in a shapefiles to be imported in a .zip package that contains, at least: file.shp file.shx file.dbf file.prj Make sure you have included all those files in your .zip package Here is a good tutorial - Intro Guides Quick Data Import


6

Geometries in CartoDB are by default stored with two different coordinate reference systems (CRS). the_geom has coordinates in Degree, while the_geom_webmercator has coordinates in units of meter or smaller depending on latitude. Both systems can be used world wide (Web Mercator excluding the pole areas), but both systems are not appropriate to measure ...


6

You could create an Object before layer.on('loaded'... with the legend keys you want to use for this dataset, for example: const LEGEND_KEYS = { LT: 'Least Threatened', VU: 'Vulnerable', CR: 'Critically Endangered', EN: 'Endangered' } And then, when updating the legend: colorLegendList += `<li><span ...


5

In answer to my own question, I've written a program to "vectorize" an ArcInfo Grid ASCII files as an ESRI shapefile with a single layer containing oriented polygonal grid squares centered at the points of the grid, with an attribute value equal to the value at the coordinates of the centroid. The program (still under development) is available on GitHub. An ...


5

One of the great things about structured text like this (generally fixed width data) is that it is pretty easy to parse out using a programming language. I used almost the same approach that @congrene used, but I wrote it with Python, which is widely used in the GIS community. You'll note that in many cases the City and State are not fully populated. ...


5

It's not measured in "Rows" but in disk space. http://cartodb.com/pricing The free plan is 5MB, the Magellan plan is 50MB. If you want to get fancy and try and figure out how many rows you can have, try this page - http://technet.microsoft.com/en-us/library/aa933068(v=SQL.80).aspx - you'll need a decent idea as to your table structure/datatypes.


5

If it's only for 50 people you can share it with Dropbox and it'll work. Another option that is a little complex, but very fast, is using S3 to host a static website. I think Dropbox would suit you better. You can do cool things then, like: it's versioned for a month (you can restore previous versions via the Dropbox web-interface). you can edit the file ...


5

You've hit on the major difference between CartoDB and MapBox. CartoDB provides an in-browser geodatabase that you can store your data in, and interact with easily via API. MapBox (if you're making your own custom layers) requires you to create tiles in TileMill, and you can interact with those pre-made tiles, but you can't access or change the underlying ...


Only top voted, non community-wiki answers of a minimum length are eligible