Bounding Box Coordinates - arcgis

I was reading the ArcGIS API for JavaScript version 4.14 documentation and cannot find an answer.
I'm spending hours looking into your documentation but it seems I cannot find a way to do a simple thing that can be done with any other mapping library (see Google Maps, Mapbox, Here etc etc).
I have a Map and a MapView, I would like to have the points of the bounding box of the map/mapview every time the map changes (North East / South West) to trigger a search on the database only on this area.
The map works perfectly, I'm trying to use the watcher:
viewMap.watch("stationary", function (status) {
if (status) {
PerformSearch();
}
});
function PerformSearch() {
var searchOptions = {
CurrentPage: 1,
Boundaries: { North: viewMap.extent.ymax, East: viewMap.extent.xmax, South: viewMap.extent.ymin, West: viewMap.extent.xmin },
....
}
But i see that viewMap.extent gives me a spatial reference that is not valid for me, I would like to just have the position as latitude and longitude of both points.
Is there a way to do it?
Many thanks... Any help would be apreciated!

The coordinates of the extent of the view are in the spatial reference system of the map, and this is determined by the spatial reference system of the basemap layer. If you are using Web Maps, like ESRI, OpenStreetMap, etc, then is Web Mercator WKT 3857.
Now, in order to get latitude/longitude you need to transform to Geographic coordinates. In this case you can use webMercatorUtils to obtain a transformed extent, something like this,
let geoExt = webMercatorUtils.webMercatorToGeographic(viewmap.extent);
ArcGIS API Doc webMercatorUtils

Related

How to generate a wavesurfer with multiple peak colors using videojs-wavesurfer or wavesurfer.js?

Is there a way to have multiple colors with the peaks using videojs-wavesurfer?
Please refer to the below image for ref.
Current implementation of videojs-wavesurfer with video is giving the output as below
videojs-wavesurfer ref link https://collab-project.github.io/videojs-wavesurfer/#/

Qt3D Billboards: how to make plane always face to camera

I try to use camera's viewVector to make plane face to camera, but it will turn Clockwise or Counterclockwise when Camera rotate to left or right.
Can I make the plane always face to camera without turning Clockwise or Counterclockwise?
I think camera->upVector() can help me maybe, but I don't how to use.
My code :
class planeTransformClass : public Qt3DCore::QTransform {
public:
planeTransformClass( Qt3DCore::QNode *entity = nullptr ) :Qt3DCore::QTransform(entity) {}
signals:
void faceTo( QVector3D v ) {
setRotation(QQuaternion::rotationTo(QVector3D(0,1,0), -v));
} ;
};
// Background
Qt3DCore::QEntity *planeEntity = new Qt3DCore::QEntity(rootEntity);
Qt3DExtras::QPlaneMesh *planeMesh = new Qt3DExtras::QPlaneMesh(planeEntity);
planeMesh->setHeight(2);
planeMesh->setWidth(2);
Qt3DExtras::QTextureMaterial planeMaterial = new Qt3DExtras::QTextureMaterial(planeEntity);
Qt3DRender::QTexture2D *planeTexture = new Qt3DRender::QTexture2D(planeMaterial);
FlippedTextureImage *planeTextureImage = new FlippedTextureImage(planeTexture);
planeTextureImage->setSize(QSize(3000, 3000));
planeTexture->addTextureImage(planeTextureImage);
planeMaterial->setTexture(planeTexture);
planeMaterial->setAlphaBlendingEnabled(true);
// Transform
planeTransformClass planeTransform = new planeTransformClass(planeEntity);
planeTransform->setRotationX(90);
planeTransform->setTranslation(QVector3D(2, 0, 0));
planeEntity->addComponent(planeMesh);
planeEntity->addComponent(planeMaterial);
planeEntity->addComponent(planeTransform);
// connect camera's viewVectorChanged
camera->connect( camera, &Qt3DRender::QCamera::viewVectorChanged,
planeTransform, &planeTransformClass::faceTo);
Solution using geometry shader
There is already a C++ translation this QML code that I tried to translate (using geometry shader):
https://github.com/ismailsunni/qt3d-custom-shader
My own translation can be found here. It works now after solving the issues mentioned in this question.
Solution without geometry shader
I got a different version running based on this bug report. You can find my implementation on GitHub. The billboards don't change their size when the camera moves, i.e. become smaller and larger on screen like every other object, but I hope you can work with that.
On the master branch the images also move for some reason as can be seen in this image:
The no_instanced_rendering branch doesn't use instanced rendering and displays everything correctly.
Edit
I'm sorry I'm not using your example but I don't have time anymore to adjust it. Check out the patch related to the bug report I mentioned. The person implemented a material with this effect, you should be able to extract it and make it run.

Keen IO Chart Labels

I'm trying to figure out how to adjust the labels on an Area Chart visualization of my Keen IO data. I've looked through the available configuration options, but I'm not seeing what option would do this. Currently my chart just lists "null" on the legend on the right side of the chart, and on the hover tooltips when you hover over a particular peak. Just looking to switch it to list "Hits" instead of "null."
Does anyone know how/where I would configure those labels?
You can use labelMappingfor that. Something like:
client.draw(funnel, document.getElementById("chart"), {
library: "google",
chartType: "columnchart",
labelMapping: {
null: "Hits"
}
});

What is the field of view(FOV) of the color camera in Kinect for Windows V2?

Can't find it anywhere. The kinectforwindows site has the FOV for depth camera. I can't find it in the box either.
#user1809923 is correct. I contacted the developer of the link:
http://smeenk.com/kinect-field-of-view-comparison/
And he responded with this information:
If I remember correctly these FOV values are part of the
framedescriptions that you can retrieve with help of the Kinect SDK.
Since other people asked for the same info I will update the my blog.
I confirmed his findings by calling the frame's framedescription in the Kinect SDK code and printing the values to the screen.
According to this post
http://smeenk.com/kinect-field-of-view-comparison/
the FOV of the color camera is 84.1 x 53.8. I am not sure, where the author found this information though.
I just wanted to add some more information to this, because the official Kinect Fusion documentation is really bad and because the answer here is correct but the numbers are rounded:
assuming, you already have a initialized IColorFrameSource* (e.g. with the name pColorFrameSource) you should retrieve the information after you opened the reader: pColorFrameSource->OpenReader(&m_pColorFrameReader); with m_pColorFrameReader beeing IColorFrameReader*
the code to retrieve the FOV then looks like this:
IFrameDescription *f=nullptr;
float fovDiago = 0;
float fovHori = 0;
float fovVerti = 0;
HRESULT hh=pColorFrameSource
->CreateFrameDescription(ColorImageFormat::ColorImageFormat_Rgba,&f);
if (hh == S_OK) {
f->get_DiagonalFieldOfView(&fovDiago);
f->get_HorizontalFieldOfView(&fovHoront);
f->get_VerticalFieldOfView(&fovVerti);
}
The FOV values not rounded are:
fovDiago =91.9000015
fovHori =84.0999985
fovVerti =53.7999992

Accessing the different regions of a border layout

In Sencha's API for border layout it says:
There is no BorderLayout.Region class in ExtJS 4.0+
What I found on various blogs, for accessing the center panel was this:
var viewPort = Ext.ComponentQuery.query('viewport')[0];
var centerR = viewPort.layout.centerRegion;
Again to the docs, I see that centerRegion is a private function (why?), and I don't care to rely on those, for future proofing. Also, there is no westRegion, northRegion, etc...
How does one get to these items?
I could of course get the items inside the regions: The various panels, and such, but I want complete control of the viewport that holds my border layout.
This is what I'm doing now:
var viewPort = Ext.ComponentQuery.query('viewport')[0];
var view = Ext.widget('my-new-tab-panel');
viewPort.layout.centerRegion.removeAll();
viewPort.layout.centerRegion.add(view);
Is there a better way?
Usually, I setup an id for each container I have to work with. So, my center region will have an id and I'll get it with Ext.getCmp() function.
Otherwise, to access to the viewport items you can do as follows:
var viewPort = Ext.ComponentQuery.query('viewport')[0];
var view = Ext.widget('my-new-tab-panel');
viewPort.items.items[0].removeAll();
viewPort.items.items[0].add(view);
If you've defined center region as the first item of viewport, then the above code it's ok but if you've defined it as the third or the fourth, then you have to change the index according to the position of your region (viewPort.items[3] or viewPort.items[4], etc).
Another way is to use query selector:
var cr = viewPort.down('panel[region=center]');
cr.removeAll();
cr.add(view);
However, following this way, you have to query on a precisely xtype (as panel in this case).
Anyway, I think the best way is to use an id for each region.