Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to position Cesium3DTileset? #137

Closed
siljec opened this issue Dec 1, 2019 · 1 comment
Closed

How to position Cesium3DTileset? #137

siljec opened this issue Dec 1, 2019 · 1 comment
Labels

Comments

@siljec
Copy link

siljec commented Dec 1, 2019

Hi there, I'm new to cesium/resium.

I have uploaded a 3D-tile asset to https://cesium.com/ion/ and I'm able to render it, but how can I position it based on longitude and latitude on the map?

import {hot} from "react-hot-loader/root";
import React from "react";
import {Viewer,Cesium3DTileset} from "resium";
import {IonResource, ColorBlendMode} from "cesium";

const App = () => {
    let viewer;

    const handleReady = tileset => {
        if (viewer) {
            viewer.zoomTo(tileset).otherwise(function (error) {
                console.log(error);
            });
        }
    };

    return (
        <Viewer
            full
            ref={e => {
                viewer = e && e.cesiumElement;
            }}
        >
                <Cesium3DTileset
                    url={IonResource.fromAssetId(58415)}
                    onReady={handleReady}
                    onClick={(position) => console.log(position)}
                    colorBlendMode={ColorBlendMode.HIGHLIGHT}
                />
        </Viewer>
    )
};

export default hot(App);

EDIT: Just realised that i could change the tile location in Cesium Ion when I uploaded a collada .dae file. Could not change the location with the .kmz file I tried first. Would be nice if you could overwrite that position in the code though, but adjusting it in Cesium Ion will do:)

@rot1024
Copy link
Member

rot1024 commented Dec 3, 2019

I have not ever used Cesium3DTileset via Cesium Ion, but it seems to be that Cesium doesn't have a function to overwrite positions of a Cesium3DTileset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants