World.markerList.push(new Marker(singlePoi)); ====> This is where finally the Marker is created and added to the markerList
end loop
Second:
you have to change the marker.js File
there is a line :
var markerLocation = new AR.GeoLocation(poiData.latitude, poiData.longitude, poiData.altitude); (Line 16 of the marker.js Sample phonegap app)
This line is now obsolete an can be deleted because your poiData now has a poiData.location Geolocation Object
AND:
var markerObject = new AR.GeoObject(markerLocation, { (Line 54 of marker.js phonegap sample)
needs to be changed to
var markerObject = new AR.GeoObject(poiData.location, { (Line 54 of marker.js phonegap sample)
I hope you get it running. If not you should try to do some debugging. Pass some fixed values of height to see if it works and use colsole.log to debug output your caculations to see if the right vales get returned.
kind regards,
Alexander
R
Ramesh Krishnamoorthy
said
over 10 years ago
Hi Alexander,
Sorry to bother you again. I had already done the changes as suggested by you and had done debugging also. For some reason it doesn't seem to work for me. I have tried hard coding the altitude for one of the POIs, even that is not working.
for (var i=0; i<World.placeGeoObjects.length; i++) { //go through all items in each cluster for (var j=0; j<World.placeGeoObjects.places.length; j++) { singlePoi = World.placeGeoObjects.places; // the singlePoi altitude is originally 0 // it will be increased by 250 for each item remaining in the cluster try{ singlePoi.altitude = World.getNewAltitude(singlePoi, j); singlePoi.location.altitude = singlePoi.altitude; }catch(e){ alert(e.message); }
if (singlePoi.title.indexOf('Blah Blah') != -1) { singlePoi.location.altitude = 1500; ===> hard coding the altitude for one POI } World.markerList.push(new Marker(singlePoi)); } }
I have done the marker.js change also through this line: var markerLocation = poiData.location;. This is slightly different than what you had suggested but it should be fine. Is there something else I could be missing. I read somewhere in the forum that the accuracy that is received by onLocationChanged matters for altitude setting. Does it?
I really appreciate your help. Thanks
K. Ramesh
A
Alexander Ohlei
said
over 10 years ago
Hi,
i just developed a working sample which uses the clustering based on the Wikitude Sample. You can use it to integrate it into the PhoneGap Sample of wikitude 3.1. You just have to add the modified clustering.js and poisFromWebService.js which are attachted to this message.
(dont forget to include <script type="text/javascript" src="js/clustering.js"></script> in the <HEAD> area of the index.html inside the world folder :)
kind regards,
Alexander
A
Alexander Ohlei
said
over 10 years ago
Hi,
you could try to work it out step by step.
First take the marker.js an do
var markerLocation = new AR.GeoLocation(poiData.latitude, poiData.longitude, 250);
if this works then you can try the next change like :
var markerLocation = new AR.GeoLocation(poiData.latitude, poiData.longitude, 0);
markerLocation.altitude = 250;
if this works then you can set
markerLocation = poiData.location;
poiData.location.altitude = 250;
and so on, try to make as little change as possible from the original to see where the problem lies.
kind regards,
Alexaner
R
Ramesh Krishnamoorthy
said
over 10 years ago
I added the below code in the markerObject creation where I am increasing the altitude on a click. Even this is not working! The alert shows up corretly and the altitude number keeps increasing by 500. But the marker remains at the same height!
Do you have any feedback based on my latest reply? I know I am bothering you, but I am stuck and no one else, including Wikitude support team, seem to have an answer. Please help.
Thx
K. Ramesh
R
Ramesh Krishnamoorthy
said
over 10 years ago
Hello Andreas,
Can you guys help out? Alexander gave some good leads on the issue. Apparently it is working for him. But whatever I have tried, it doesn't seem to work for me. I have provided enough details on the various thigs I have tried. Anything else I need to try to make this altitude thing work correctly?
Why is it so difficult to get answers from Wikitude support team? I know I am still on the trial version, but without getting the issues sorted out, how can I decide to buy the paid version? Please help out.
K. Ramesh
A
Andreas Fötschl
said
about 8 years ago
Hi there!
Note that it is not enough to "just define a clustering" once in your code.
* You need to ensure that the user's location is repoted properly to the AR-view (via setLocation).
* Also note that you need to re-cluster your pois when the user moves or location updates arrive (letting user "jump for several meters", which destroys your previous calculations)
Also consider to implement your own clustering approach, the one I provided in the old posts is very basic and groups the POIs by view-angles.
Best regards
A
Alexander Ohlei
said
over 10 years ago
Hi there,
I was a little busy lately :)
I checked your code and found something: ert shows up corretly and the altitude number keeps increasing by 500. But the marker remains at the same height!
Besides the hints of Alexander please also ensure you pass altitude '0' information to architectView on Location updates. Otherwise your altitude clustering is not working as you expect it - as states in page 1 of this post already.
Kind regards, Andreas
Wikitude Technical Support
said
over 6 years ago
Please find clustering.js attached - just n case you came across but noticed that public dropbox link is no longer working
Thanks for the response. I understood what you are saying, finally! All along I was trying to set the altitude as '0' when I was creating the singlePoi obj and trying to increase it later using the clustering code. Finally it dawned on me that you are talking about the setLocation call on the architectView. Once I realized my mistake and set it, it started working. Now the markers are showing up at different heights. Thanks to you and Alexander.
K. Ramesh
m
m0j1 42420
said
over 10 years ago
Hi , I'm also trying to do this to avoid clusteing my POIs , but I don't get what is the difference between "clusterAngle" and "bubbleAngle" ? the bubbleAngle isn't even defined in the code. and even if I assume them the same by 'var bubbleAngle = clusterAngle;' and try to run the code , when I debug I see the cluster clusteredPois array is empty. I'll appreciate if you can help me with this.
Parvaz Bhaskar