Note that there are some explanatory texts on larger screens.

plurals
  1. POError calling method on NPObject exception with google earth
    primarykey
    data
    text
    <p>I'm trying to implement a Google Earth controller via Websockets.</p> <p>I have a simple echo websockets server in c#, when i type a value in a textbox it just sends it back to the page (I plan to be able to directly send data from the server later).</p> <p>My script to initialize google earth is pretty standard and works:</p> <pre><code> &lt;script type="text/javascript"&gt; google.load("earth", "1"); function init() { google.earth.createInstance('map3d', initCallback, failureCallback); StartServer(); } function initCallback(instance) { ge = instance; ge.getWindow().setVisibility(true); // add a navigation control ge.getNavigationControl().setVisibility(ge.VISIBILITY_AUTO); // add some layers ge.getLayerRoot().enableLayerById(ge.LAYER_BORDERS, true); ge.getLayerRoot().enableLayerById(ge.LAYER_ROADS, true); } function failureCallback(errorCode) { } &lt;/script&gt; </code></pre> <p>(ge variable) is just the google earth instance.</p> <p>Now in my server code, if I do:</p> <pre><code> ws.onmessage = function (evt) { inc.innerHTML += evt.data + '&lt;br/&gt;'; var lookAt = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND); lookAt.setLatitude(lookAt.getLatitude() + 10); lookAt.setLongitude(lookAt.getLongitude() + 20); ge.getView().setAbstractView(lookAt); }; </code></pre> <p>Everything works (earth rotates a tiny bit).</p> <p>Now if I do:</p> <pre><code> ws.onmessage = function (evt) { inc.innerHTML += evt.data + '&lt;br/&gt;'; var lookAt = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND); lookAt.setLatitude(lookAt.getLatitude() + evt.data); //Here i try to use the data received lookAt.setLongitude(lookAt.getLongitude() + 20); ge.getView().setAbstractView(lookAt); }; </code></pre> <p>I get exception : Error calling method on NPObject</p> <p>I tried to split string, convert to number, but always get the same error.</p> <pre><code>inc.innerHTML += evt.data + '&lt;br/&gt;'; </code></pre> <p>always works tho.</p> <p>EDIT:</p> <p>I also tried : var i = parseInt(d); //Works but then when i call l lookAt.setLatitude(i); //Exception</p> <p>Any help appreciated</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload