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

GeoJson fixes and cleanup #2148

Merged
merged 1 commit into from
Sep 30, 2014
Merged

GeoJson fixes and cleanup #2148

merged 1 commit into from
Sep 30, 2014

Conversation

mramato
Copy link
Contributor

@mramato mramato commented Sep 24, 2014

  1. Automatically set perPositionHeight to true if a polygon contains altitude values.
  2. Remove sourceUri parameter from the geometry functions since they are no longer used (and haven't been for a while).
  3. Move polygon creation code into a helper function to de-duplicate code that was in both processPolygon and processMultiPolygon
  4. Added specs and updated CHANGES.

1. Automatically set `perPositionHeight` to true if a polygon contains altitude values.
2. Remove `sourceUri` parameter from the geometry functions since they are no longer used (and haven't been for a while).
3. Move polygon creation code into a helper function to de-duplicate code that was in both `processPolygon` and `processMultiPolygon`
4. Added specs and updated CHANGES.
@mramato
Copy link
Contributor Author

mramato commented Sep 29, 2014

@emackey as we discussed offline, here's a simple example that showed the problem. In master, the polygon is drawn on the ground, even though the input provides heights. This branch correctly draws it at altitude.

//Create the viewer 
var viewer = new Cesium.Viewer('cesiumContainer');
Cesium.viewerEntityMixin(viewer);
var geo = {
    "type" : "FeatureCollection",
    "features" : [{
        "type" : "Feature",
        "geometry" : {
            "type" : "Point",
            "coordinates" : [102.0, 0.6, 1e5]
        }
    }, {
        "type" : "Feature",
        "geometry" : {
            "type" : "LineString",
            "coordinates" : [[102.0, 0.0, 1e5], [103.0, 1.0, 1e3], [104.0, 0.0, 1e5], [105.0, 1.0, 1e2]]
        }
    }, {
        "type" : "Feature",
        "geometry" : {
            "type" : "Polygon",
            "coordinates" : [[[100.0, 0.0, 1e6], [101.0, 0.0, 1e6], [101.0, 1.0, 1e6], [100.0, 1.0, 1e6], [100.0, 0.0, 1e6]]]
        }
    }]
};

var dataSource = new Cesium.GeoJsonDataSource();
viewer.dataSources.add(dataSource);
dataSource.load(geo);

//Reset the scene when switching demos. 
Sandcastle.reset = function() {
    var camera = viewer.scene.camera;
    camera.lookAt(Cesium.Cartesian3.fromDegrees(100, 0, 5000000), Cesium.Cartesian3.fromDegrees(100, 0, 0), Cesium.Cartesian3.UNIT_Z);
};

@mramato mramato mentioned this pull request Sep 30, 2014
@emackey
Copy link
Contributor

emackey commented Sep 30, 2014

Looks good. Tests pass. Merging.

emackey added a commit that referenced this pull request Sep 30, 2014
@emackey emackey merged commit 65abef5 into master Sep 30, 2014
@emackey emackey deleted the geojson-heights branch September 30, 2014 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants