Questions Keep Getting auto deleted (5th attempt)

1. A concise explanation of the problem you’re experiencing.

I’m sending this from home, since work posts get auto deleted (Lets see if this one does too)

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

Seems like a simple request, but no one (that I’ve talked to) can do this.

Drop a pin onto globe after searching for a specific location.

Camera always flies directly to location on any search, but grabbing lat/lon is harder than it looks.

Since the camera knows where to fly to, (it must already know lat/long)

Would like to drop a pin so that ANY search pre-drops a pin onto globe before the camera gets there.

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

Client asked for this feature. Is this possible?

4. The Cesium version you’re using, your operating system and browser.

Latest cesium, Firefox.

Have you seen this thread? It has a code example for overriding the “destinationFound” event in the geocoder:

https://groups.google.com/d/msg/cesium-dev/RYzGH_8PGQo/4HPS0bvyBgAJ

Here it’s showing how to fly to the location found, but you can add code to drop a billboard in addition or instead of flying there. Let me know if that helps.

Oh yes, I've played with that example for hours. Cannot get a thing out of
it, except the # of characters out of the search bar.

For example, if I search for
123 mai

(not even finishing 123 Main Street)

I only get back what I actually typed

123 mai

which isn't very helpful.

I've tried inspecting various combinations attempting to grab the lat/lon
but it just doesn't seem to be exposed.

Is there a "Select * from exposed methods" list? (or whatever) - It's
frustrating to only have 1 example, which takes you to destination - but
no other properties.

--Shawn

Have you seen this thread? It has a code example for overriding the
"destinationFound" event in the geocoder:

https://groups.google.com/d/msg/cesium-dev/RYzGH_8PGQo/4HPS0bvyBgAJ

Here it's showing how to fly to the location found, but you can add code
to drop a billboard in addition or instead of flying there. Let me know if
that helps.

I think the issue is that searchText gets updated right after that function is called. If you check viewModel._searchText instead of viewModel.searchText, it should have the full selected value (so if you type “123 M” and then select the full address, .searchText will have only what you typed and _searchText will have the full address).

Here's what I've tried to get the xyz values again.

You already have the xyz location, that’s the destination:

var viewer = new Cesium.Viewer(‘cesiumContainer’);

viewer.geocoder.viewModel.destinationFound = function(viewModel, destination) {

console.log(destination.x);

console.log(destination.y);

console.log(destination.z);

};

``

You can create a billboard with an image at that destination, like in the billboards example: https://sandcastle.cesium.com/index.html?src=Billboards.html

Omar,

That's what I thought, but I don't believe it's really the destination
(from the alertbox - same example page)

This is current position in deep space, but is called destination=
X=-808935.2818322802 Y=-5492868.930112202 Z=3128685.901578763

when I'm (eventually arriving here)

Lat. & Long. 29.566684 -98.377734

(see attached image for test address)

btw, this helped

", .searchText will have only what you typed and _searchText will have the
full address)"

Is there some math I should do on those XYZ values?

--Shawn

You already have the xyz location, that's the destination:

var viewer = new Cesium.Viewer('cesiumContainer');

viewer.geocoder.viewModel.destinationFound = function(viewModel,
destination) {
    console.log(destination.x);
    console.log(destination.y);
    console.log(destination.z);
};

You can create a billboard with an image at that destination, like in the
billboards example:

Destination.jpg

Those coordinates are not in deep space. They are in fact Texas, exactly at the longitude and latitude you have in the image. You can confirm this by converting it to a longitude/latitude pair:

var cartographic = Cesium.Cartographic.fromCartesian(new Cesium.Cartesian3(-808935.2818322802, -5492868.930112202, 3128685.901578763));

var latitude = cartographic.latitude * Cesium.Math.DEGREES_PER_RADIAN;

var longitude = cartographic.longitude * Cesium.Math.DEGREES_PER_RADIAN;

console.log("latitude: " + latitude);

console.log("longitude: " + longitude);

``

You can also confirm it by placing a billboard at that coordinate to visually see that it is in the right place, on Earth:

viewer.geocoder.viewModel.destinationFound = function(viewModel, destination) {

viewer.entities.add({

position : destination,

billboard :{

image : ‘…/images/facility.gif’

}

});

};

``

The X/Y/Z coordinates are very large because they’re in the ECEF (https://en.wikipedia.org/wiki/ECEF) coordinate system.

HA! That’s funny. This is definitely what I wanted to hear.

Perfect. Now I can finish my project.

Thank-you!

–Shawn