help with search paramaters

3 views
Skip to first unread message

mickm

unread,
Dec 15, 2009, 8:29:12 PM12/15/09
to Google AJAX APIs
hi,

i'm doing the following search:

http://ajax.googleapis.com/ajax/services/search/local?v=1.0&q=hospital&sll=37.331689,-122.030731&radius=10&num=10

thing is, i get the same results back with or without the radius and
num. i'm looking to be able to expand and contract the search
depending on the number of responses i get back.

am i missing something here?

Jeremy Geerdes

unread,
Dec 15, 2009, 8:34:16 PM12/15/09
to google-ajax...@googlegroups.com
I would suggest reading the documentation. Neither the radius nor the
num parameters are recognized by the AJAX Search API. You can obtain 4
or 8 results by including the rsz=small or large parameter,
respectively. There is no equivalent documented parameter for radius.

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:
http://jgeerdes.home.mchsi.com
http://jgeerdes.blogspot.com
http://jgeerdes.wordpress.com
jgee...@mchsi.com

Unless otherwise noted, any price quotes contained within this
communication are given in US dollars.

If you're in the Des Moines, IA, area, check out Debra Heights
Wesleyan Church!

And check out my blog, Adventures in Web Development, at http://jgeerdes.blogspot.com
!
> --
>
> You received this message because you are subscribed to the Google
> Groups "Google AJAX APIs" group.
> To post to this group, send email to google-ajax...@googlegroups.com
> .
> To unsubscribe from this group, send email to google-ajax-searc...@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/google-ajax-search-api?hl=en
> .
>
>

Mickey Mestel

unread,
Dec 16, 2009, 1:03:40 AM12/16/09
to google-ajax...@googlegroups.com
jeremy,

I would suggest reading the documentation. Neither the radius nor the
num parameters are recognized by the AJAX Search API. You can obtain 4
or 8 results by including the rsz=small or large parameter,
respectively. There is no equivalent documented parameter for radius.


i've had a hard time finding the docs, but i'm new to looking around these sites.  i'm at 


and in the Location sections it talks the radius parameter, things like that.  is there better documentation for this? is there a better way to search for what i'm doing, looking to get JSON return data?

thanks,

mickm
 

Jeremy Geerdes

unread,
Dec 16, 2009, 7:36:47 AM12/16/09
to google-ajax...@googlegroups.com
Check out the links below:


This is the official documentation, and you'll find very helpful information in there about using the Search API, including the LocalSearch portion, via the RESTful (JSON) interface as you are. Specifically, if you scroll down on the second link, you'll find a list of all the arguments you can use with the Local Search portion of the API. In your case, you'll want to check out the sll and sspn parameters. Please note, though, that sspn is not exactly the same as a hard radius. It's more like telling the search to concentrate in a given area, but to still return anything interesting that it finds nearby.

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:

Unless otherwise noted, any price quotes contained within this communication are given in US dollars.

If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church!

And check out my blog, Adventures in Web Development, at http://jgeerdes.blogspot.com !


Mickey Mestel

unread,
Dec 16, 2009, 12:59:39 PM12/16/09
to google-ajax...@googlegroups.com
jeremy,


thanks, enormously helpful, don't know why i had such a hard time getting to these docs.

i am using sll, but a quick question about sspn.  i'm doing this from the iphone SDK,  so i don't have access to the google's mapkit.  actually, i didn't think about checking to see if they have an iphone library, so you know if they do?

but at this point, all i really need is to make use of sspn, but that comes from map kit functions.  do you know how this is derived?  can i create my own valid values, or do i need the map kit functions?

thanks again...

mickm 

Jeremy Geerdes

unread,
Dec 16, 2009, 1:15:05 PM12/16/09
to google-ajax...@googlegroups.com
You can create your own valid values, but it's a little bit tricky. Basically, you need to take your center lat/lng coordinates and calculate a bounding box which would contain the radius you want to focus on. In other words, you want to find the northern-, eastern-, southern-, and western-most lat and lng coordinates of that radius. You then subtract the south coordinate from the north, and the west from the east. You then set your sspn to (north-south),(east-west) and send off the request.

The trick here is that lines of longitude are not parallel, so 10km east of your starting point is a different longitude at 45 latitude than it is as 35. To compensate, you'll need a great circle algorithm to calculate these points. There are a number of these out there, but most that I've seen are for calculating distances between two lat/lng pairs. You'll need to solve for latb or lngb

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:

Unless otherwise noted, any price quotes contained within this communication are given in US dollars.

If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church!

And check out my blog, Adventures in Web Development, at http://jgeerdes.blogspot.com !


Mickey Mestel

unread,
Dec 16, 2009, 1:56:42 PM12/16/09
to google-ajax...@googlegroups.com
jeremy,

thanks for everything.  i have some mapping friends, so i'll talk to them about the circle algorithm.

mickm
Reply all
Reply to author
Forward
0 new messages