0

Good Evening Stackoverflow Lords & Ladies,

I am attempting to develop a Layar layer to use at my work but I'm having some difficulties right out of the gate. Here's the scenario

I have downloaded the Sample Code that Layar provides for the tutorial, Here's the link

Now I have not modified ANY of this code.

I have set up a database with the name of joejoz_layar In that database, I have imported the included .SQL file and THAT creates TWO tables, Layer & POI.

Now I just want to see how this thing is connecting and what the output looks like, so I upload all the included files to my server, and travel to firstTutorial_simplified.php on my box.

This is the error I get:

Message: layerName parameter is not passed in GetPOI request. Warning: Cannot modify header information - headers already sent by (output started at firstTutorial_simplified.php:64) in firstTutorial_simplified.php on line 225 {"layer":null,"hotspots":[],"errorCode":20,"errorString":"No POI found. Please adjust the range."}

Now the SQL import does include ONE POI so I'm really confused on what I'm doing wrong here. Here's the config.inc.php that I modified:

  define('DBHOST', 'localhost');
  define('DBDATA', 'joejoz_layar');
  define('DBUSER', 'joejo_layar01');
  define('DBPASS', 'XXXXXXXXX');

I've try to find the answer elsewhere only to run into stuff in Swedish... which I don't speak. Can someone NOT related to the Swedish Chef help me?

Murphy1976
  • 1,415
  • 8
  • 40
  • 88

2 Answers2

2

It looks to me as your not passing all the required values to $_GET

eg: $_GET['layerName'], $_GET['lat'], $_GET['lon'] and $_GET['radius']

keys must match the key/value array that your sending to getRequestParams($keys); line 191,

Line 56 in firstTutorial_simplified.php matches $keys with isset($_GET[$key]) thus invoking the exception on line 59 if ones missing.

This is an API that returns a json string but you need to pass parameters

./firstTutorial_simplified.php?layerName=somelayer&lat=12345&lon=12345&radius=12345

Visiting the script directly will invoke errors as there is no checks

so really you just need todo some isset() checks else not run the code.

Lawrence Cherone
  • 46,049
  • 7
  • 62
  • 106
  • OK... so if I've just let everything be, then it "should work." When all is said an done, and I test this scripts through the Layar Layer test API, I get this response: `Loading layer "getechfair"... found layer = getechfair Loading POIs Loading POIs for page #1 oauth disabled POI fwd url = http://layar.wellhey.com/firstTutorial_complete.php?lang=en&countryCode=US&userId=6f85d06929d160a7c8a3cc1ab4b54b87db99f74b&lon=4.887339&version=6.0&lat=52.377544&layerName=getechfair&accuracy=100 Response received from provider, validating... response code : 200` – Murphy1976 Mar 01 '12 at 01:04
  • `Traceback (most recent call last): File "/var/www/layar.com/app/api/handlers/api_layer/mainproxy.py", line 335, in get_pois raise RuntimeError("Invalid JSON response") RuntimeError: Invalid JSON response oauth disabled POI fwd url = http://layar.wellhey.com/firstTutorial_complete.php?lang=en&countryCode=US&userId=6f85d06929d160a7c8a3cc1ab4b54b87db99f74b&lon=4.887339&version=6.0&lat=52.377544&layerName=getechfair&accuracy=100 Response received from provider, validating... response code : 200` – Murphy1976 Mar 01 '12 at 01:05
  • `Traceback (most recent call last): File "/var/www/layar.com/app/api/handlers/api_layer/mainproxy.py", line 335, in get_pois raise RuntimeError("Invalid JSON response") RuntimeError: Invalid JSON response Error: No content available` I know there's at least ONE POI that should be showing up, and I even modified the LAT and LON so it would be closer to home. – Murphy1976 Mar 01 '12 at 01:05
0

The fact that you get "Please adjust the range." and "No POI found" means that it is working. It is just that the query to your layer did not find Points of interest withing the radius of the range. The sample POI in the database is the Layar office in amsterdam. On the layar test site it comes up with amsterdam in the google map but by default the range does not cover the location of the layar office. If you use the slider on the test page to make your range bigger you will probably find that you do locate a POI.

I might be wrong about this but here is the response I get from my setup [when viewed on the layar test site] of the firstTutorial_simplified.php which does find POIs if you change the range or move the person around on the test layar. I guess your error message has more severe issues than just the "No POI found. Please adjust the range." And I guess yours does not say "response validated"

Loading layer "ttguyhellowld1"...
found layer = ttguyhellowld1
Loading POIs
Loading POIs for page #1
oauth disabled
POI fwd url = http://home.exetel.com.au/ttguy/layar/firstTutorial_simplified.php?lang=en&countryCode=AU&lon=4.887339&userId=6f85d06929d160a7c8a3cc1ab4b54b87db99f74b&version=6.2&radius=1500&lat=52.377544&layerName=ttguyhellowld1&accuracy=100
Response received from provider, validating...
response code : 200
Response validated, sending it back...
oauth disabled
POI fwd url = http://home.exetel.com.au/ttguy/layar/firstTutorial_simplified.php?lang=en&countryCode=AU&lon=4.887339&userId=6f85d06929d160a7c8a3cc1ab4b54b87db99f74b&version=6.2&radius=1500&lat=52.377544&layerName=ttguyhellowld1&accuracy=100
Response received from provider, validating...
response code : 200
Response validated, sending it back...
Error: No POI found. Please adjust the range.
Loaded 0 POIs

On the other hand if I point my browser directly to the firstTutorial_simplified.php I get this message:

Message: layerName parameter is not passed in GetPOI request.{"layer":null,"hotspots":[],"errorCode":20,"errorString":"No POI found. Please adjust the range."}

But the layar still works when tested from the layar test site. So "layerName parameter is not passed in GetPOI request" is not fatal.

Cfr
  • 5,092
  • 1
  • 33
  • 50
ttguy
  • 23
  • 5