{"id":18673228,"url":"https://github.com/cartodb/cesium-cartodb","last_synced_at":"2025-07-06T00:34:43.366Z","repository":{"id":27405307,"uuid":"30882086","full_name":"CartoDB/cesium-cartodb","owner":"CartoDB","description":null,"archived":false,"fork":false,"pushed_at":"2015-02-16T20:37:35.000Z","size":3900,"stargazers_count":16,"open_issues_count":2,"forks_count":8,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-10-12T16:54:12.434Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CartoDB.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-16T18:32:51.000Z","updated_at":"2020-02-21T09:03:04.000Z","dependencies_parsed_at":"2022-09-16T12:12:52.346Z","dependency_job_id":null,"html_url":"https://github.com/CartoDB/cesium-cartodb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CartoDB%2Fcesium-cartodb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CartoDB%2Fcesium-cartodb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CartoDB%2Fcesium-cartodb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CartoDB%2Fcesium-cartodb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CartoDB","download_url":"https://codeload.github.com/CartoDB/cesium-cartodb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223486810,"owners_count":17153241,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T09:14:29.652Z","updated_at":"2024-11-07T09:14:30.421Z","avatar_url":"https://github.com/CartoDB.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CartoDB integration for Cesium\n\nThis plugin helps integrate [CartoDB](http://cartodb.com) maps and data layers into [Cesium](http://cesiumjs.org).\n\n## Server-side layer integration\n\nCartoDB's server-side layers include basemaps and data layers generated in the server. For this, the pluging adds a new imagery provider to Cesium, `CartoDBImageryProvider`.\n\n### Installation\n\nYou can use `.../src/cesium-cartodb.js` as is or run `grunt build` to get a minified version `.../build/cesium-cartodb.min.js`. You must include either after including Cesium in your html.\n\n```html\n\u003cscript src=\"\u003cpath_to\u003e/Cesium.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"\u003cpath_to\u003e/cesium-cartodb.min.js\"\u003e\u003c/script\u003e\n```\n\n### Usage\n\nAfter this, you can create new imagery objects in Cesium and use them as needed. `CartoDBImageryProvider` is derived from [Cesium's OpenStreetMap imagery provider](http://cesiumjs.org/Cesium/Build/Documentation/OpenStreetMapImageryProvider.html), and can be initialized and used just the same.\n\n#### Basemap layer\n\nJust add a `CartoDBImageryProvider` instance to a viewer in order to use CartoDB's basemaps in Cesium.\n\n```js\nvar basemapProvider = new Cesium.CartoDBImageryProvider({\n    url: '\u003cMAP_TEMPLATE_URL\u003e', // e.g.: http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png,\n    credit: 'Basemap courtesy of CartoDB'\n});\nvar viewer = new Cesium.Viewer('cesiumContainer', {\n    imageryProvider: basemapProvider,\n    baseLayerPicker: false,\n    fullscreenButton: false,\n    homeButton: false,\n    timeline: false,\n    navigationHelpButton: false,\n    animation: false,\n    scene3DOnly: true,\n    geocoder: false\n});\n```\n\n#### Data layer\n\nIn order to have a data layer from tiles generated in CartoDB, use cartodb.core.js's getTiles to inject the tiles in Cesium.\n\n```js\nvar layerData = {\n    user_name: '\u003cUSER_NAME',\n    sublayers: [{\n        sql: \"\u003cSQL_QUERY\u003e\",\n        cartocss: '\u003cCARTOCSS\u003e'\n    }]\n};\ncartodb.Tiles.getTiles(layerData, function (tiles, err) {\n    if (tiles == null) {\n        console.log(\"error: \", err.errors.join('\\n'));\n        return;\n    }\n    viewer.scene.imageryLayers.addImageryProvider(new Cesium.CartoDBImageryProvider({\n        url: tiles.tiles[0],\n        credit: 'Data courtesy of CartoDB'\n    }));\n});\n```\n\n## Client-side data layer\n\nYou can use CartoDB's SQL API to use data in CartoDB with Cesium renderers. You only need to make user data is in geoJSON format.\n\n```js\nvar dataSource = new Cesium.GeoJsonDataSource();\nviewer.dataSources.add(dataSource);\n\nvar sql = new cartodb.SQL({user: '\u003cUSER_NAME\u003e', format: 'geoJSON'});\nsql.execute(\"SQL_QUERY\")\n        .done(function (data) {\n            dataSource.load(data)\n                    .then(function () {\n                    })\n        })\n        .error(function (errors) {\n            // errors contains a list of errors\n            console.log(\"errors:\" + errors);\n        });\n```\n\n## Examples\n\nYou can run a local HTTP server by running `grunt` in the root folder and then point your browser to http://127.0.0.1:8000/examples/ to see the examples.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcartodb%2Fcesium-cartodb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcartodb%2Fcesium-cartodb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcartodb%2Fcesium-cartodb/lists"}