spatial search

13 views
Skip to first unread message

Christian

unread,
Dec 20, 2009, 2:45:25 AM12/20/09
to Google Data APIs Objective-C Client Library Discussion
Hi,

I walked through the examples and the Maps code but I couldn't find a
find a spatial query.
Is the feature not implemented?

regards
Christian

Greg Robbins

unread,
Dec 20, 2009, 4:09:26 AM12/20/09
to gdata-objec...@googlegroups.com
Within a few weeks I'll be adding to the top-of-trunk library support for the new Maps query parameters, but you don't need to wait for that. Just call addCustomParameterWithName:value: on a GDataQueryMaps object to add any parameter you want for the search.

colionel

unread,
Jan 7, 2010, 11:04:36 AM1/7/10
to Google Data APIs Objective-C Client Library Discussion
This is great !

But i wonder how to use this with coordinates search, what parameters
are expected ? Is the ones one this page : http://mapki.com/wiki/Google_Map_Parameters

I thought i could use use the center location parameter ("sll") and
span parameter ("spn") to retrieve only the features within a certain
region. But i must be doing something wrong since i get exactly the
same number of entries with our without the query :

i get 1000 entries if i use :

ticket = [service fetchFeedWithURL:featuresFeedURL delegate:self
didFinishSelector:@selector(featuresTicket:finishedWithFeed:error:)];

and i also get 1000 entries if i use :

GDataQueryMaps* query = [GDataQueryMaps
mapsQueryWithFeedURL:featuresFeedURL];
[query addCustomParameterWithName:@"ll" value:@"48.844384,2.36412"];
[query addCustomParameterWithName:@"spn" value:@"0.143248,0.344353"];
ticket = [service fetchFeedWithQuery:query delegate:self
didFinishSelector:@selector(featuresTicket:finishedWithFeed:error:)];


Your help would be greatly appreciated !

Thanks,
Vincent

Greg Robbins

unread,
Jan 7, 2010, 11:18:43 AM1/7/10
to gdata-objec...@googlegroups.com
The Google Maps Data API supports a limited set of search query parameters; they are listed at



The Objective-C library does now include the Maps Data API spatial query parameters in the top-of-trunk sources; see

http://code.google.com/p/gdata-objectivec-client/source/browse/trunk/Source/Clients/Maps/GDataQueryMaps.h

colionel

unread,
Jan 8, 2010, 8:39:31 AM1/8/10
to Google Data APIs Objective-C Client Library Discussion
Thanks for your answer.

Based on the source from GDataQueryMaps.m on the trunk i tried the
following :

GDataQueryMaps* query = [GDataQueryMaps
mapsQueryWithFeedURL:featuresFeedURL];

[query addCustomParameterWithName:@"lat" value:@"48.844384"];
[query addCustomParameterWithName:@"lng" value:@"2.36412"];
[query addCustomParameterWithName:@"radius" value:@"10000"];

ticket = [service fetchFeedWithQuery:query delegate:self
didFinishSelector:@selector(featuresTicket:finishedWithFeed:error:)];

It returns 0 entry (and no error). Without the query and with the map
centered on the same point (48.844384, 2.36412 = paris) i can see over
a 100 placemarks.

Have you been able to do a spatial search on a google "my maps" ?

Thanks,
Vincent.


On 7 jan, 17:18, Greg Robbins <grobb...@google.com> wrote:
> The Google Maps Data API supports a limited set of search query parameters;
> they are listed at
>

> http://code.google.com/apis/maps/documentation/mapsdata/developers_gu...


>
> The Objective-C library does now include the Maps Data API spatial query
> parameters in the top-of-trunk sources; see
>

> http://code.google.com/p/gdata-objectivec-client/source/browse/trunk/...

Greg Robbins

unread,
Jan 8, 2010, 4:14:33 PM1/8/10
to gdata-objec...@googlegroups.com
I just tried with the MapsSample example application. I created a public map in my account, put in placemarks a few hundred km apart, then used the sample application's "In circle:" values for latitude, longitude, and radius to limit the search, and it worked as expected, showing a feed of just the placemarks within that radius.

Take a look at -fetchFeaturesOfSelectedMap in the sample application's sources at
http://code.google.com/p/gdata-objectivec-client/source/browse/trunk/Examples/MapsSample/MapsSampleWindowController.m

colionel

unread,
Jan 22, 2010, 7:26:54 AM1/22/10
to Google Data APIs Objective-C Client Library Discussion
Hi thanks for your answer !

I finally managed to make it work using the -
fetchFeaturesOfSelectedMap sample.

The problem came from a bug in the maps API, i cannot directly use the
featuresFeedURL property from the MapEntry.

here is how to get the proper featureFeedUrl (extracted from the -
fetchFeaturesOfSelectedMap sample code)

// The Maps API does not provide a clean way to get the URL for the
// snippets feed (bug 2335402)
NSString *featuresStr = [featuresFeedURL absoluteString];
NSString *snippetsStr = [featuresStr
stringByReplacingOccurrencesOfString:@"/full" withString:@"/snippet"];
NSURL *snippetsURL = [NSURL URLWithString:snippetsStr];

GDataQueryMaps* query = [GDataQueryMaps
mapsQueryWithFeedURL:snippetsURL];

[query addCustomParameterWithName:@"lat" value:@"48.844384"];
[query addCustomParameterWithName:@"lng" value:@"2.36412"];
[query addCustomParameterWithName:@"radius" value:@"10000"];


Thanks for your help,
Vincent.

> sources athttp://code.google.com/p/gdata-objectivec-client/source/browse/trunk/...

Reply all
Reply to author
Forward
0 new messages