-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Update New York CityGML 3D Tileset #6555
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
858ff1d
Update New York CityGML 3D Tileset
shehzan10 1d8471e
New New York CityGML Tileset uses Cesium World Terrain
shehzan10 093d304
Use built in radians function for styling
shehzan10 221c8e4
Update NYC Tileset (uses gltf2 PBR, fixes in batch table)
shehzan10 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,45 +42,41 @@ | |
}); | ||
|
||
// Load the NYC buildings tileset. | ||
var tileset = new Cesium.Cesium3DTileset({ url: Cesium.IonResource.fromAssetId(3839) }); | ||
var tileset = new Cesium.Cesium3DTileset({ url: Cesium.IonResource.fromAssetId(4258) }); | ||
viewer.scene.primitives.add(tileset); | ||
|
||
// Color buildings based on their height. | ||
function colorByHeight() { | ||
tileset.style = new Cesium.Cesium3DTileStyle({ | ||
color: { | ||
conditions: [ | ||
["${height} >= 300", "rgba(45, 0, 75, 0.5)"], | ||
["${height} >= 200", "rgb(102, 71, 151)"], | ||
["${height} >= 100", "rgb(170, 162, 204)"], | ||
["${height} >= 50", "rgb(224, 226, 238)"], | ||
["${height} >= 25", "rgb(252, 230, 200)"], | ||
["${height} >= 10", "rgb(248, 176, 87)"], | ||
["${height} >= 5", "rgb(198, 106, 11)"], | ||
["Number(${height}) >= 300", "rgba(45, 0, 75, 0.5)"], | ||
["Number(${height}) >= 200", "rgb(102, 71, 151)"], | ||
["Number(${height}) >= 100", "rgb(170, 162, 204)"], | ||
["Number(${height}) >= 50", "rgb(224, 226, 238)"], | ||
["Number(${height}) >= 25", "rgb(252, 230, 200)"], | ||
["Number(${height}) >= 10", "rgb(248, 176, 87)"], | ||
["Number(${height}) >= 5", "rgb(198, 106, 11)"], | ||
["true", "rgb(127, 59, 8)"] | ||
] | ||
} | ||
}); | ||
} | ||
|
||
// Color buildings by their total area. | ||
function colorByArea() { | ||
tileset.style = new Cesium.Cesium3DTileStyle({ | ||
color: "mix(color('yellow'), color('red'), min(${area} / 10000.0, 1.0))" | ||
}); | ||
} | ||
|
||
// Color buildings by their latitude coordinate. | ||
function colorByLatitude() { | ||
tileset.style = new Cesium.Cesium3DTileStyle({ | ||
defines: { | ||
latitudeRadians: "Number(${latitude}) * 0.0174532925" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use built in |
||
}, | ||
color: { | ||
conditions: [ | ||
["${latitude} >= 0.7125", "color('purple')"], | ||
["${latitude} >= 0.712", "color('red')"], | ||
["${latitude} >= 0.7115", "color('orange')"], | ||
["${latitude} >= 0.711", "color('yellow')"], | ||
["${latitude} >= 0.7105", "color('lime')"], | ||
["${latitude} >= 0.710", "color('cyan')"], | ||
["${latitudeRadians} >= 0.7125", "color('purple')"], | ||
["${latitudeRadians} >= 0.712", "color('red')"], | ||
["${latitudeRadians} >= 0.7115", "color('orange')"], | ||
["${latitudeRadians} >= 0.711", "color('yellow')"], | ||
["${latitudeRadians} >= 0.7105", "color('lime')"], | ||
["${latitudeRadians} >= 0.710", "color('cyan')"], | ||
["true", "color('blue')"] | ||
] | ||
} | ||
|
@@ -91,7 +87,7 @@ | |
function colorByDistance() { | ||
tileset.style = new Cesium.Cesium3DTileStyle({ | ||
defines : { | ||
distance : "distance(vec2(${longitude}, ${latitude}), vec2(-1.291777521, 0.7105706624))" | ||
distance : "distance(vec2(Number(${longitude}) * 0.0174532925, Number(${latitude}) * 0.0174532925), vec2(-1.291777521, 0.7105706624))" | ||
}, | ||
color : { | ||
conditions : [ | ||
|
@@ -105,14 +101,14 @@ | |
// Color buildings with a '3' in their name. | ||
function colorByNameRegex() { | ||
tileset.style = new Cesium.Cesium3DTileStyle({ | ||
color : "(regExp('3').test(${name})) ? color('cyan', 0.9) : color('purple', 0.1)" | ||
color : "(regExp('3').test(String(${name}))) ? color('cyan', 0.9) : color('purple', 0.1)" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the string cast required? |
||
}); | ||
} | ||
|
||
// Show only buildings greater than 200 meters in height. | ||
function hideByHeight() { | ||
tileset.style = new Cesium.Cesium3DTileStyle({ | ||
show : "${height} > 200" | ||
show : "Number(${height}) > 200" | ||
}); | ||
} | ||
|
||
|
@@ -121,11 +117,6 @@ | |
onselect : function() { | ||
colorByHeight(); | ||
} | ||
}, { | ||
text : 'Color By Area', | ||
onselect : function() { | ||
colorByArea(); | ||
} | ||
}, { | ||
text : 'Color By Latitude', | ||
onselect : function() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had talked about this earlier, but is the cast required? Does it suggest something is different about the new tileset?