sinhrks / cesiumpy Goto Github PK
View Code? Open in Web Editor NEWLightweight Python wrapper of Cesium.js for 3D geospatial visualization
License: Apache License 2.0
Lightweight Python wrapper of Cesium.js for 3D geospatial visualization
License: Apache License 2.0
I tried to run this on a recent version of Jupyter notebook:
import cesiumpy
v = cesiumpy.Viewer()
v.entities.add(cesiumpy.Box(dimensions=(40e4, 30e4, 50e4),
material=cesiumpy.color.RED, position=(-120, 40, 0)))
v
But I get this warning:
/home/juanlu/.pyenv/versions/3.7.4/envs/mbp37/lib/python3.7/site-packages/cesiumpy/extension/geocode.py:12: UserWarning: Since July 2018 Google requires each request to have an API key. Pass a valid `api_key` to GoogleV3 geocoder to hide this warning. See https://developers.google.com/maps/documentation/geocoding/usage-and-billing
_GEOCODER = GoogleV3()
a JavaScript error message:
ReferenceError: Cesium is not defined
and a blank recangle:
Running the example on an HTTPS Ipython Server leads to this problem in Chrome and probably other browsers.
Mixed Content: The page at 'https://...ipynb' was loaded over HTTPS, but requested an insecure stylesheet 'http://cesiumjs.org/Cesium/Build/Cesium/Widgets/widgets.css'. This request has been blocked; the content must be served over HTTPS.
Basically we should always be loading content over HTTPS as that means it works for both HTTP and HTTPS sites.
When trying to follow the tutorial within a Jupyter notebook, I noticed that I get an error:
import cesiumpy
v = cesiumpy.Viewer()
b = cesiumpy.Box(dimensions=(40e4, 30e4, 50e4), material=cesiumpy.color.RED, position=[-120, 40, 0])
v.entities.add(b)
Javascript error adding output!
ReferenceError: Cesium is not defined
See your browser Javascript console for more details.
If I do this instead:
import cesiumpy
v = cesiumpy.CesiumWidget()
v
Then I get the nice globe. If I now call the first code in a new cell once again, it will work just fine. Seems to me that the Viewer() method is not loading cesium.js correctly.
Using Firfox on Ubuntu 16.04.
Use fiona
.
Hi there doesn't seem to be any support for time based animations except loading in a czml file.
So entities don't seem to have the availability, epoch properties I don't see support for position data with time_step, lng, lat, height format either ?
Maybe they are called something else I see a reference to Clock class maybe that is what I need.
I think it could be useful to have the full czml protocol accessible via python data structure directly (instead of via uri), useful for programmatic generation of scenarios.
so one can write like:
simple_czml =[
{ "id":"document", "version":"1.0" } ,
{
"id": "InternationalSpaceStation",
"position":
...
and then somehow send this to the cesiumjs library
On cesium you can normally add an entity and fly to that entity:
var wyoming = viewer.entities.add({
name: 'Wyoming',
// polygon :: Cesium.PolygonGraphics
polygon: {
// polygon longitude and latitude (not totally accurate)
hierarchy: Cesium.Cartesian3.fromDegreesArray([
-109.080842, 45.002073,
-105.91517, 45.002073,
-104.058488, 44.996596,
-104.053011, 43.002989,
-104.053011, 41.003906,
-105.728954, 40.998429,
-107.919731, 41.003906,
-109.04798, 40.998429,
-111.047063, 40.998429,
-111.047063, 42.000709,
-111.047063, 44.476286,
-111.05254, 45.002073
]),
material: Cesium.Color.RED.withAlpha(0.5)
}
});
viewer.flyTo(wyoming).then(function(result){
if (result) {
viewer.selectedEntity = wyoming;
}
});
I just tried this with an entity I added via ob = v.dataSources.add()
but I wasn't able run v.camera.flyTo(ob)
, it didn't fly anywhere.
How can this be done? Also I'm a bit confused as to how Cesium's Javascript API maps to the Python object API, some things are placed in different areas.
We are interested in potentially building an extension for our GeoViews library on top of cesiumpy. I've started building a prototype and that all went fairly smoothly but in doing so I've noticed that development for cesiumpy has basically stalled and some APIs have diverged from the latest CesiumJS.
Therefore I wondering whether this project is basically abandoned or whether there is some hope of continued development? If you have given up active maintenance it would be good to know: 1) would you hand over maintenance to someone else and 2) how much work do you think it would be to update cesiumpy to work smoothly with the latest version of CesiumJS?
Hi @sinhrks,
Thank you for providing this Cesium wrapper. Thank you for making this available, it looks really promising.
I was wondering whether it is possible to save a static image of the js-viewer? There must be some buffer which I could catch and save, but I couldn't find it.
The goal is to make a movie and to zoom in on a particular site.
Any help/pointers would be greatly appreciated.
Kind regards,
Bas
import cesiumpy
v = cesiumpy.CesiumWidget()
v
I now get a widget with a globe on it. However, every time I click the cell output will get a bit bigger. If I hit some keys, the cell output also grows bigger vertically. This seems to affect all widget cells and not just the current cell that I am clicking on.
Allow users to change default geocoder, etc.
I'm testing cesiumpy both in Jupyter notebook and in html mode. It works as expected in Jupyter notebook after installing ipywidgets (pip install ipywidgets).
In html, however, the viewer loads but there is only empty space (without the globe). What can I do to fix it.
I wrote a file index.html with the v.to_html() method.
Thanks
Was trying to use:
res = cesiumpy.io.read_shape("pipelines.shp")
v = cseiumpy.Viewer()
v.entities.add(res, material="red")
v
And it gave me that ValueError exception. The pipeline shape file can be downloaded here: https://data.gov.au/dataset/oil-and-gas-pipelines-of-australia
I'm running Python 2 with latest master cesiumpy==0.4.0.dev0
and Shapely==1.5.17
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.