Start a new topic
Solved

Geobject Does not appear in the screen. Emergent Help!!!!

 Hi Guys,


I am working a geo-base ar project and i am stuck with it. I can not move forward and it is terrible. In the given below it is a simple code like poi at location example. I can pass parameters from backend or i can call a WS to get pois. After i run the app i control the status message and it is

1 place loaded

 but whatever i did, i could not draw the markers. So no error occured but no marker is drawn also.  I try imageontarget example it is working. But i think geoobject has a problem or i do something wrong.


Please i need an emergent help.

 

 

// implementation of AR-Experience (aka "World")
var World = {
	// true once data was fetched
	initiallyLoadedData: false,

	// POI-Marker asset
	markerDrawable_idle: null,

	// called to inject new POI data
	loadPoisFromJsonData: function loadPoisFromJsonDataFn(poiData) {

		/*
			The example Image Recognition already explained how images are loaded and displayed in the augmented reality view. This sample loads an AR.ImageResource when the World variable was defined. It will be reused for each marker that we will create afterwards.
		*/
		World.updateStatusMessage("loadpois 1");
		World.markerDrawable_idle = new AR.ImageResource("assets/radar_bg.png");
        World.updateStatusMessage("loadpois 2");

		/*
			For creating the marker a new object AR.GeoObject will be created at the specified geolocation. An AR.GeoObject connects one or more AR.GeoLocations with multiple AR.Drawables. The AR.Drawables can be defined for multiple targets. A target can be the camera, the radar or a direction indicator. Both the radar and direction indicators will be covered in more detail in later examples.
  */
        
        World.updateStatusMessage("loadpois 2.5");
          World.updateStatusMessage("loadpois 2.5"+poiData.latitude+" : "+poiData.longitude);
		var markerLocation = new AR.GeoLocation(singlePoi.latitude, singlePoi.longitude, singlePoi.altitude);
		World.updateStatusMessage("loadpois 3");
		var markerImageDrawable_idle = new AR.ImageDrawable(World.markerDrawable_idle, 2.5, {
			zOrder: 0,
            opacity: 1.0
		});
        World.updateStatusMessage("loadpois 4");
		// create GeoObject
		var markerObject = new AR.GeoObject(markerLocation,{
			drawables: {
				cam: markerImageDrawable_idle
			}

		});
       World.updateStatusMessage("load pois 5");
		// Updates status message as a user feedback that everything was loaded properly.
		World.updateStatusMessage('1 place loaded');
	},

	// updates status message shon in small "i"-button aligned bottom center
	updateStatusMessage: function updateStatusMessageFn(message, isWarning) {

		var themeToUse = isWarning ? "e" : "c";
		var iconToUse = isWarning ? "alert" : "info";

		$("#status-message").html(message);
		$("#popupInfoButton").buttonMarkup({
			theme: themeToUse
		});
		$("#popupInfoButton").buttonMarkup({
			icon: iconToUse
		});
	},

	// location updates, fired every time you call architectView.setLocation() in native environment
	locationChanged: function locationChangedFn() {

		/*
			The custom function World.onLocationChanged checks with the flag World.initiallyLoadedData if the function was already called. With the first call of World.onLocationChanged an object that contains geo information will be created which will be later used to create a marker using the World.loadPoisFromJsonData function.
		*/

			// creates a poi object with a random location near the user's location
            World.updateStatusMessage("location changee geldim");
			World.loadPoisFromJsonData(myJsonData);
			World.initiallyLoadedData = true;
	},
};

/*
	Set a custom function where location changes are forwarded to. There is also a possibility to set AR.context.onLocationChanged to null. In this case the function will not be called anymore and no further location updates will be received.
*/
//AR.context.onLocationChanged = World.locationChanged;

 

 

// implementation of AR-Experience (aka "World")
var World = {
	// true once data was fetched
	initiallyLoadedData: false,

	// POI-Marker asset
	markerDrawable_idle: null,

	// called to inject new POI data
	loadPoisFromJsonData: function loadPoisFromJsonDataFn(poiData) {

		/*
			The example Image Recognition already explained how images are loaded and displayed in the augmented reality view. This sample loads an AR.ImageResource when the World variable was defined. It will be reused for each marker that we will create afterwards.
		*/
		World.updateStatusMessage("loadpois 1");
		World.markerDrawable_idle = new AR.ImageResource("assets/radar_bg.png");
        World.updateStatusMessage("loadpois 2");

		/*
			For creating the marker a new object AR.GeoObject will be created at the specified geolocation. An AR.GeoObject connects one or more AR.GeoLocations with multiple AR.Drawables. The AR.Drawables can be defined for multiple targets. A target can be the camera, the radar or a direction indicator. Both the radar and direction indicators will be covered in more detail in later examples.
  */
        
        World.updateStatusMessage("loadpois 2.5");
          World.updateStatusMessage("loadpois 2.5"+poiData.latitude+" : "+poiData.longitude);
		var markerLocation = new AR.GeoLocation(singlePoi.latitude, singlePoi.longitude, singlePoi.altitude);
		World.updateStatusMessage("loadpois 3");
		var markerImageDrawable_idle = new AR.ImageDrawable(World.markerDrawable_idle, 2.5, {
			zOrder: 0,
            opacity: 1.0
		});
        World.updateStatusMessage("loadpois 4");
		// create GeoObject
		var markerObject = new AR.GeoObject(markerLocation,{
			drawables: {
				cam: markerImageDrawable_idle
			}

		});
       World.updateStatusMessage("load pois 5");
		// Updates status message as a user feedback that everything was loaded properly.
		World.updateStatusMessage('1 place loaded');
	},

	// updates status message shon in small "i"-button aligned bottom center
	updateStatusMessage: function updateStatusMessageFn(message, isWarning) {

		var themeToUse = isWarning ? "e" : "c";
		var iconToUse = isWarning ? "alert" : "info";

		$("#status-message").html(message);
		$("#popupInfoButton").buttonMarkup({
			theme: themeToUse
		});
		$("#popupInfoButton").buttonMarkup({
			icon: iconToUse
		});
	},

	// location updates, fired every time you call architectView.setLocation() in native environment
	locationChanged: function locationChangedFn() {

		/*
			The custom function World.onLocationChanged checks with the flag World.initiallyLoadedData if the function was already called. With the first call of World.onLocationChanged an object that contains geo information will be created which will be later used to create a marker using the World.loadPoisFromJsonData function.
		*/

			// creates a poi object with a random location near the user's location
            World.updateStatusMessage("location changee geldim");
			World.loadPoisFromJsonData(myJsonData);
			World.initiallyLoadedData = true;
	},
};

/*
	Set a custom function where location changes are forwarded to. There is also a possibility to set AR.context.onLocationChanged to null. In this case the function will not be called anymore and no further location updates will be received.
*/
//AR.context.onLocationChanged = World.locationChanged;

 

 


Hello Arda,

The Wikitude SDK does not provide a location strategy, which means that the location has to be provided to the SDK by using architectView.setLocation (latitude, longitude, altitude).

Please refer to the documentation section here. You will find all the information you need at our documentation.

Thanks
Eva

 

Hello,


I have same problem in android device. iOS application working fine with same js,html, css, and assets files.


How can I fix this case ? 


Best Regards.

Hi Eva,


I have sent an email. looking forward to hear you

Thanks

 

Hello,

Please send your complete AR experience (.html, .css, .js files, assets, target images) so we can test internally, but not the whole app. You can upload it here or send it to support@wikitude.com.

Thanks
Eva

 

Hi Eva,

The coordinates are true because i get the lat and long from gps of the mobile phone. For any case, I have checked it from the google maps and the lat and long points the place where i am. I have already changed the north and east parameters nothing changed. Is there a limitation with your api in Turkey? But i tried your tripadvisor app and it works fine at the location.  i want to send the whole app via email as you said earlier and check the code please. Or i need the talk with the developer who developed your tripadvisor app.




 

Hi Ersel,

From what I understand, RelativeLocation is working fine if you want to place your augmented object relative to your position, but it is not working if you want it relative to a fixed location. That could be because the coordinates for the fixed location are not correct. So what i would suggest is you try only the fixed location and see if you are getting the augmented object and then if this is working try and see if you are setting the correct coordinates on your relative location. For instance, in the code you sent over, the augmented object will appear 10 meters north and 10 meters east than the mylocation. if this is too far then try to place it closer.

Thanks
Eva
Hi Eva,

I am getting the location exactly. So no problem about getting locations. whether use relative location or not when i create a geolocation i get nothing, I test with relative location because try to create a location 10 m north and east of my location but when i give the geolocation the app fails to show geobject. When i give the location as null and just create a relative location app shows geobject clearly.

There would be a bug at geolocation?



 

Hi,

When working with Geo locations you can choose either RelativeLocation or GeoLocation. The concept of RelativeLocation is that they are always relative to the current user location and this is why we prefer these when we need to test. GeoLocations are fixed to a certain latitude/longitude coordinate and stay at exact this place. In order to make sure that you have specified the correct coordinates when working with GeoLocations you can also advice these websites to Convert Lat and Long to Address and to Get Latitude and Longitude.

I hope this helps
Eva
Hi Eva,

I have found a clue,

If i create a geolocation the lat and long is here given manuelly but normally getting from App properly.
The geobject does not appear as given first test case. On the other hand if i create a relative location and do not give the actual location geobject appears properly as given in 2 test case.

1-)

        var myLocation = new AR.GeoLocation(41.0198,28.8901);
        var markerLocation = new AR.RelativeLocation(myLocation, 10, 10, 0);

 2-)

   var markerLocation = new AR.RelativeLocation(null, 10, 10, 0);

 

 

Hi Ersel,

One problem could be that the POIs you have specified in your JSON file are too far away and this is why you cannot see anything. Please check again the coordinates of the POIs you have created. If the problem still occurs then please send over you whole AR experience (.html, .css, .js files, assets, target images) so we can test internally.

Thanks
Eva

 

Hi Eva,

I already got the code from your samples and fellow the instructions in the docs. This has an enourmous problem for us. Could you please check the code.

Please suggets me something real.


 

Hello Ersel,

Since you are loading your data locally from a JSON file, did you make sure to follow exactly the instructions from our documentation here? Also, you could try with our sample app to see if this is working for you and if it is follow our code as a pattern and modify it in order to fit your use case.

Thanks
Eva
Login or Signup to post a comment