Geo location proxy help required

Hi guys I have created an proxy for getting the location of nearest stores with the help of lat&lon using google maps api.

I followed the documentation(here) in APIGEE and created an proxy but it is not working because I just copy-pasted from different sources.

I didn't need elevation so I did not use it.

I have attached the proxy, kindly see and if possible do the needful changes.

geolocation2-rev5-2015-04-22.zip

@sudheendra1

0 1 437
1 REPLY 1

Not applicable

@Barahalikar Siddharth, if you trace the execution of the proxy, you will see this error in your GenerateResponse (javascript) step:

Execution of GenerateResponse failed with error: Javascript runtime error: "ReferenceError: "Apigee" is not defined. (GenerateResponse_js#1). at line 1 "

The Apigee object you are referring to comes from the SDK at https://github.com/apigee/apigee-javascript-sdk. The problem with using this HTML5 SDK within Apigee Edge, though, is that it contains browser-esque references to window, document, Ajax, etc.

The simplest way to interact with Apigee BaaS from Apigee Edge (in plain JavaScript as opposed to Node.js) is via the REST API. You can see this at http://apigee.com/docs/app-services/content/using-api. So if you refactor your code to use httpClient (http://apigee.com/docs/api-services/cookbook/implementing-http-clients-javascript), you can accomplish the same thing.

This request works:

https://api.usergrid.com/siddharth1/sandbox/restaurants?ql=location within 10000 of 33.3,-111.9

If you use Node from within Edge, then you can take a look at the Usergrid npm module at https://npmjs.org/package/usergrid. This module functions much like the Apigee object that you originally used, but you have to use it in a Nodejs-enabled proxy, not just a JavaScript policy.