How can I move a rectangle by CZML in Cesium? - gis

I would like to ask that I defined a rectangle in czml, but we know that the rectangle is determined by four dimensions[Cesium.Rectangle(west, south, east, north)]. How should I fill in the "position" if I want to move the rectangle? I tried "cartographicDegrees" and "wsenDegrees", but I couldn't move according to time.
{
"id": "rectangle",
"rectangle": {
"coordinates": {
"wsenDegrees": [118.99, 24.99, 119.01, 25.01] //how can I change this position?
},
"height": 1000,
"fill": true,
},

I think that you need to remove the element first, and then create a new one with different position.

Related

vega-lite: set circle size at start, when you have size change on mouse over

I have created this example.
The circle size grows on mouse hover. It's what I want.
But at start, when I open the editor the circles are not 10 in size, but 200, that it's the on mouse over size. How to have their size 10 at start?
Provide the following in your size condition or check the editor. This will first check the length if any selection is made or not.
"condition": [
{
"test": {
"and": [
{"param": "paintbrush"},
"length(data(\"paintbrush_store\"))"
]
},
"value": 100
}
]
Or you can try this also:
condition": {"param": "paintbrush", "empty": false},

Vega-lite default bar width strange

I'm seeing the following oddly styled chart. I understand I can explicitly change the padding etc., but the default vega-lite layout is usually pretty good. I'm confused what I'm doing that's leading to this sub-normal behavior. Thanks! Here is the code in the vega-lite editor
I understand that I can also change x's type to ordinal to make the styling better, though I'm not sure I understand still why it is the difference I see. I need the type to be quantitative so I get the min/max brush bound, as opposed to the set.
Also I actually do not even know how to manually set the bar width after reading the documentation here https://vega.github.io/vega-lite/docs/scale.html. If anyone might have a working example that would be great.
Thanks.
As #marcprux mentioned, there is pre-binned support so you don't have to repeat the bin transform here. However, currently the prebinned support requires both bin_start and bin_end.
For now you could modify the spec to derive a new bin_end field and use it with x2.
{
"data": ...
"transform": [{
"calculate": "datum.ShareWomen_bin+0.1",
"as": "ShareWomen_bin_end"
}],
"mark": "bar",
"encoding": {
"x": {"bin": {"binned": true, "step": 0.1}, "field": "ShareWomen_bin", "type": "quantitative", "title": "ShareWomen_bin"},
"x2": {"field": "ShareWomen_bin_end"},
"y": {"field": "count", "type": "quantitative"}
}
}
like this spec.
I can see that we shouldn't require deriving bin_end and thus have created an issue to track this feature request: https://github.com/vega/vega-lite/issues/6086.
Btw, the quantitative scale only affects the bar position.
To set the bar size directly, you can use size property in a mark definition:
mark: {type: "bar", size: 5}
Since you declare "x" as a quantitative field, there's no assumption that the points along the axis are evenly distributed. E.g., you could add in some data points in between the others:
{"ShareWomen_bin": 0.83, "count": 40, "is_overview": true},
{"ShareWomen_bin": 0.87, "count": 70, "is_overview": true},
and you would see them rendered in between the other bars:
As you mention, you can specify that the bars should be encoded as ordinal values. Another solution is to leave it as quantitative, but specify that it is binned, in which case the bars will also be rendered as if they were ordinal:
"x": {"field": "ShareWomen_bin", "type": "quantitative", "bin": true},
Since it appears that your data is already binned, you should read about how vega-lite supports pre-binned data: https://vega.github.io/vega-lite/docs/bin.html#binned

Autodesk Forge - Extract geometry data from a 2D Cad Drawing using the modelderivative API

I am trying to extract data from a 2d Cad drawing. Essentially I would like to find the x/y coordinates of every element. However, the data does not show this information.
I am using the modelderivative/v2/designdata/{{urn}}/metadata/{{guid}}/properties endpoint to extract the data itself.
Here is an example of the output this gives
{
"objectid": 3308,
"name": "Text [67AC]",
"externalId": "67AC",
"properties": {
"AnnotationScaling": {
"Annotative": "No"
},
"General": {
"Color": "ByLayer",
"Handle": "67ac",
"Layer": "IMAGE-HYPERLINKS",
"Linetype": "ByLayer",
"Linetype scale": "1.000",
"Lineweight": "ByLayer",
"Name ": "Text",
"Plot style": "ByColor",
"Thickness": "0.000",
"Transparency": "ByLayer"
},
"Hyperlinks": {
"Description": ".\\R0010020.JPG",
"Name": ".\\R0010020.JPG"
},
"Misc": {
"Backward": "No",
"Upside down": "No"
},
"Text": {
"Contents": "R0010020.JPG",
"Height": "0.050",
"Justify": "Left",
"Obliquing": "0.000 deg",
"Rotation": "111.348 deg",
"Style": "Standard",
"Width factor": "1.000"
}
}
},
As you can see, there is no key 'Geometry'
Can anyone point me in the right direction on how I can extract the object positioning data for a 2d Cad drawing? Could it be that the drawing itself needs to implicitly set this information?
Here is an example of what I'm seeing in the Cad drawing itself.
Cad Output
There is no mention of the correct keys "Position X", "Position Y" in the modelderivative output above. Can anyone explain why this might be? Am I exporting it incorrectly? Or does Forge remove this information?
I am using PHP and getting the data server-side.
I exported another test model and found the following was generated
"Geometry": {
"Area": "1131855.821",
"Circumference": "3771.382 mm",
"Diameter": "1200.468 mm",
"Radius": "600.234 mm"
}
But there are no X/Y/Z coordinates in this data.
You can parse the individual primitives of your 2D drawing on the client side based on this blog post: https://forge.autodesk.com/blog/working-2d-and-3d-scenes-and-geometry-forge-viewer.
Parsing the drawing geometry on the server-side would be a bit more involved, since the file format used in Forge Viewer is not publicly documented. You could use tools like https://github.com/Autodesk-Forge/forge.commandline-nodejs, but I'm not sure if there are alternatives for PHP.

How does street view publish API judge the panorama connection that which direction should it linked to if multiple target set on one panorama?

I have an issue with the connection request in google street view publish API. Both with single and multiple target. If i create single target from source photo
{
"updatePhotoRequests": [
{
"updateMask": "connections",
" photo": {
"photoId": {
"id": "pano_3"
},
"connections": [
{
"target": {
"id": "pano_4"
}
},
]
}
}
]
}
How the above JSON request set Panorama connection to specific direction of the target panorama.
For e.g if i set a connection from pano_1 north position to pano_2 south position its not set properly. the link arrow show to right direction rather than forward or backward direction. The following image help to understand the problem
In the above image i intended to create connection to go further but its showing the right arrow button rather than forward button.
Also same issue with multiple photos
{
"updatePhotoRequests": [
{
"updateMask": "connections",
"photo": {
"photoId": {
"id": "pano_1"
},
"connections": [
{
"target": {
"id": "pano_2"
}
},
{
"target": {
"id": "pano_3"
}
}
]
}
}
]
}
#HarishKumar, the direction of the arrow is determined by the lat,lng and heading of each set of 2 panos which are linked. You may check this link for reference. Think of it as 2 vertices on a plane, you can move them anywhere on the plane or rotate them around their own center, but there's always only one straight line that connects them.
You need to edit the heading of each photo that you want to connect. Example, for pano_1 with arrow pointing to right with heading:90, your pano_2 should have a heading:270. Be noted that you need to edit both pictures. (I've done this by trial and error.)

insert custom div tags into openlayers

I am currently developping a map, using Openlayers2.
This map has to show several information
I already managed ton integrate images and canvas using
OpenLayers.Layer.Vector -> for basic images and vectors
OpenLayers.StyleMap and OpenLayers.Style -> for canvas and text
I need now to insert several boxes, integrating text.
The boxes have to adapt themself to the texts, each having different length.
I would like now to insert customized HTML tags, like a div, instead of a canvas (difficult to adapt and quite heavy to handle)
The information are integrated from a json:
Example of Json
{
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
589200.0,
2402900.0
]
},
"properties": {
"activation": "true",
"info": "one for example short text"
}
}, {
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
603700.0,
2408300.0
]
},
"properties": {
"activation": "true",
"info": My other very long text \n with lines \r different messages and so on\n and it has to fit in.."
}
}]
}
It is a legacy map, and we are stucked with Openlayer 2, so the solution wouldn't be with the version 3.
I am desesperately searching on the net a solution that would suit, without success, but I am loosing a precious amount of time with it.
The information are loaded this way :
new OpenLayers.Layer.Vector("Vector", {
layername: "myText",
resolutions: [100, 50, 25, 10],
styleMap: textStyleMap,
isBaseLayer: false,
visibility: false,
strategies: [new OpenLayers.Strategy.Fixed({
preload: true
})],
protocol: new OpenLayers.Protocol.HTTP({
url: "myText.json",
format: new OpenLayers.Format.GeoJSON()
})
})
What kind of styleMap could I use?
Has anybody a solution to the problem?
Thank you!
I finally skiped the problem using dragable popups instead.
It is an update you can find here:
http://aamirafridi.com/openlayers/openlayers-draggable-popups.