Export cesium entities to Shapefile

837 views
Skip to first unread message

amitb...@gmail.com

unread,
Nov 27, 2018, 1:29:27 AM11/27/18
to cesium-dev
I had added some entities on my project, now how can I export then into shapefile or geojson?

Omar Shehata

unread,
Nov 27, 2018, 3:58:10 PM11/27/18
to cesium-dev
I don't believe Cesium has a built in way to do this. I searched around a bit and couldn't find any community projects to do it, but it might not be too hard to try writing one yourself, that iterates over a given collection of entities and creates the shapefile/geojson text and outputs it/downloads it. If you manage to get that working it'd be really cool to share it with the community! 

amitb...@gmail.com

unread,
Nov 28, 2018, 6:25:08 AM11/28/18
to cesium-dev
Thanks for the reply.
Is there any possibility of addition of this kind of feature in future updates of cesiumjs.

Omar Shehata

unread,
Nov 29, 2018, 9:33:32 AM11/29/18
to cesium-dev
Typically users tend to convert the other way - trying to put GeoJSON or shape files into Cesium. Can you explain a bit more what kind of work you're doing that would require this feature? The Cesium team tends to prioritize features that have wider use cases, so a lot of it is community-driven.

amitb...@gmail.com

unread,
Dec 3, 2018, 12:26:36 AM12/3/18
to cesium-dev
I'm creating building and road layouts by using different shapes,lines and polygons, so i want to save the work i have done as geojson.(similar to arcscene) So i can load the work i have done directly.Is it possible.Or will there be any .cesium file in future similar to .shp file.

Omar Shehata

unread,
Dec 3, 2018, 2:21:11 PM12/3/18
to cesium-dev
There is a CZML format:


Although I'm not aware of any tool that can export a CesiumJS scene into it. That does sound like it could be a pretty cool use case. I think if you are creating these lines, shapes and polygons in your CesiumJS app, you can just loop over all the entities and their properties, and save them as a CZML. You can see a bunch of examples of how CZML looks like on Sandcastle:


Omar Shehata

unread,
Dec 3, 2018, 2:35:04 PM12/3/18
to cesium-dev
I opened a feature request for this because I think it's a really good idea:

clara...@gmail.com

unread,
Jul 17, 2019, 4:06:04 AM7/17/19
to cesium-dev
Hi there,
I also needed that feature for my project, so I got down to make it work.

If anyone is interested, here is a sandcastle of how I did it:

https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/index.html#c=1Vttc9u4Ef4rGPWDpYlCy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719+Fdf0/e9Ut51xe86wve9SXv+hW8M06Q+BGOmGJQJa9OjoqL4D2VYw9InlwxuFHJIiRQ8AVpQcNbN412YxjFa5+cC6G/yoIsCf2m43Rislz5rBztTBL3iUBGifiN2WFHDRpOvWfkTc/Gjdwf0owbiC8KemaJz29fjRvnww7IG8NYYQal3Y34Mwkmsjg+vxaNjuMMO/BrcVRMqT/BMAlrjTH49XwYT+h0LdcxjMPzzCbDeHo+nCRxDOWkUkqo+1a0grIcNrvte64q2GFHiIASgCLROyk8fOXTwk+uBbONUPa/

basically, the function just loop through the arrays of entites and writes a json file that you can then import back into Cesium

Omar Shehata

unread,
Jul 19, 2019, 2:33:20 PM7/19/19
to cesium-dev
This looks pretty awesome Clara, thank you for sharing that! We also just recently implemented a KML export option that could be useful here as well:

Reply all
Reply to author
Forward
0 new messages