Kazu46Machi / earth-api-samples

Automatically exported from code.google.com/p/earth-api-samples
0 stars 0 forks source link

LatLonAltBox for Regions is broken #190

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Run the below code in the Earth API Interactive Sampler

What is the expected output or behavior? What do you see instead?
The placemark should only appear when zooming into (0,0). Instead, the
placemark always appears. Removing the LOD causes the placemark to never
appear. Non-trivial Lod's do work, but LatLonAltBox doesn't.

Which plugin version are you using?
4.3.11x

Which browsers and operating systems are affected?
All

Please provide any additional information (code snippets/links) below.

var llaBox = ge.createLatLonAltBox('');
llaBox.setAltBox(5, -5, 5, -5, 0, 0, 10000, ge.ALTITUDE_RELATIVE_TO_GROUND);

var lod = ge.createLod('');
lod.set(-1, -1, 0, 0); // degenerate/trivial Lod

var region = ge.createRegion('');
region.setLatLonAltBox(llaBox);
region.setLod(lod);

var point = ge.createPoint('');
point.setLatitude(0);
point.setLongitude(0);

var pointPlacemark = ge.createPlacemark('');
pointPlacemark.setGeometry(point);
pointPlacemark.setRegion(region);
ge.getFeatures().appendChild(pointPlacemark);

Original issue reported on code.google.com by api.roman.public@gmail.com on 27 Mar 2009 at 6:32

GoogleCodeExporter commented 8 years ago
Regions are working if you change the order of the statements. You should first
append the placemark to your ge instance and then set the region.

var pointPlacemark = ge.createPlacemark('');
pointPlacemark.setGeometry(point);
ge.getFeatures().appendChild(pointPlacemark);
pointPlacemark.setRegion(region);

Original comment by norbert....@gmail.com on 9 Apr 2009 at 8:04

GoogleCodeExporter commented 8 years ago
Hi Norbert,

I'm not having any luck with regions, even with setting the region after 
creating and 
adding the placemark.

Tested using plugin v.5.0.11655.6079

- Roman

Original comment by api.roman.public@gmail.com on 9 Apr 2009 at 5:49

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi Roman and Norbert
Thanks for taking the time to look into this issue.  It's something I've been 
trying 
to sort out for some time.  After reading your comments I've just managed to 
get it 
to work.  This is the code that I used - Norbert's advice about creating and 
appending the placemark first has done the trick:

          placemark = ge.createPlacemark('');          
          var point = ge.createPoint('');
          point.setLatitude(54.64009);
          point.setLongitude(-3.04990);
          placemark.setGeometry(point);
      ge.getFeatures().appendChild(placemark);

          //create the region
          var region=ge.createRegion('');
      var loDetail=ge.createLod('');
          var latLonAlt=ge.createLatLonAltBox('');
      latLonAlt.setAltBox(54.64732,54.05191,-3.04308,-
                  3.05603,180,0,3000,ge.ALTITUDE_RELATIVE_TO_GROUND);
      loDetail.set(128,-1,64,256)             
          region.set(latLonAlt,loDetail);
          placemark.setRegion(region);

I've loaded it onto a server where you can see it work - if you zoom out, the 
placemark disappears (and vice versa):

http://english-lake-district.info/test/region-test.html

Thanks again both of you for the help.  Its very much appreciated.

Justin

Original comment by justinfa...@hotmail.co.uk on 9 Apr 2009 at 8:42

GoogleCodeExporter commented 8 years ago
Ok, I was misusing LatLonAltBox in the original bug report. This works fine:

var llaBox = ge.createLatLonAltBox('');
llaBox.setAltBox(5, -5, 5, -5, 0, 0, 0, ge.ALTITUDE_RELATIVE_TO_GROUND);

var lod = ge.createLod('');
lod.set(128, -1, 0, 0);

var region = ge.createRegion('');
region.setLatLonAltBox(llaBox);
region.setLod(lod);

var point = ge.createPoint('');
point.setLatitude(0);
point.setLongitude(0);

var pointPlacemark = ge.createPlacemark('');
pointPlacemark.setGeometry(point);
pointPlacemark.setRegion(region);
ge.getFeatures().appendChild(pointPlacemark);

SO, the core problem seems to be that newly created regions need to be 
explicitly 
given an Lod.

I haven't seen any differences in behavior related to order of the calls.

Original comment by api.roman.public@gmail.com on 9 Apr 2009 at 9:02

GoogleCodeExporter commented 8 years ago

Original comment by api.roman.public@gmail.com on 22 May 2009 at 1:39

GoogleCodeExporter commented 8 years ago

Original comment by api.roman.public@gmail.com on 9 Aug 2009 at 12:52

GoogleCodeExporter commented 8 years ago
Bulk edit.

Original comment by api.roman.public@gmail.com on 9 Aug 2009 at 1:02

GoogleCodeExporter commented 8 years ago

Original comment by api.roman.public@gmail.com on 9 Aug 2009 at 1:14

GoogleCodeExporter commented 8 years ago

Original comment by api.roman.public@gmail.com on 28 Jul 2011 at 4:08

GoogleCodeExporter commented 8 years ago

Original comment by jli...@google.com on 6 Jun 2013 at 9:21