Closed GoogleCodeExporter closed 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
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
[deleted comment]
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
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
Original comment by api.roman.public@gmail.com
on 22 May 2009 at 1:39
Original comment by api.roman.public@gmail.com
on 9 Aug 2009 at 12:52
Bulk edit.
Original comment by api.roman.public@gmail.com
on 9 Aug 2009 at 1:02
Original comment by api.roman.public@gmail.com
on 9 Aug 2009 at 1:14
Original comment by api.roman.public@gmail.com
on 28 Jul 2011 at 4:08
Original comment by jli...@google.com
on 6 Jun 2013 at 9:21
Original issue reported on code.google.com by
api.roman.public@gmail.com
on 27 Mar 2009 at 6:32