Discussion Forums  >  Uncategorized

Replies: 6    Views: 221

Zeta_M
Apple Fan
Profile
Posts: 23
Reg: Sep 07, 2011
Aguadilla,Puert...
230
10/23/11 08:04 PM (14 years ago)

Near by option - Possible in buzztouch?

Hi, I am developing a Nightlife White Pages app. Which will contain different bars/discotheques in Puerto Rico. I've seen some apps that they have a near by functionality in which you set how many miles away you want to search for locations, and it will show you the list. I would like something like that for my app. Each of the bars/discotheques are placed in the map provided by buzztouch, I don't know if that would help. Have anyone done this? Thanks!
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
10/23/11 10:41 PM (14 years ago)
Totally doable. Does take some skill but very popular. The idea is that the Data URL property in the advanced settings of a map points to a file or script on your website that lists all the locations. The device sends it's current location in the request so the script (on your site) can filter the list. See this: http://www.buzztouch.com/forum/thread.php?tid=65181E4ADF97874B08E6D2B
 
Walms
Code is Art
Profile
Posts: 235
Reg: Aug 24, 2011
Derby
3,300
like
10/24/11 09:56 AM (14 years ago)
cool might use this myself!
 
SammyJ
I hate code!
Profile
Posts: 4
Reg: Sep 17, 2011
London
40
like
10/26/11 06:51 AM (14 years ago)
David, thank you very much for your response to my other post. Very useful. Thanks also for BT, very excited about the upcoming roadmap. Is there a way to do this with all the date inside the app? I'm trying to make an app that people will use when they're abroad so will likely have data roaming turned off.
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
10/26/11 08:26 AM (14 years ago)
There's always a way. Think 'plugin.' The easy part... a) Copy the location map file class BT_screen_map.m and .h. Create a new class called myMap.m and .h. Copy all the code into each file from the BT_screen_map.m and .h files. At this point the only thing different in each file is the name of the class. b) Create a custom plugin screen in your control panel. Use myMap as the classFileName name in the JSON data. c) Connect this new screen to a menu or button. d) Re-compile your project. At this point you should have a blank map loading with no location. But, the map class that is loading is your class, not the BT_screen_map.m class. The tough part... This is where your logic comes in. First you'll need to create a plain text file in your project with the JSON data. Start by copying the data for the original map so you can see the format. Name it something like myMapData.txt. Look at the code in your class and change it so the data is read from the 'bundled file' and not the internet or the cache. Look at the loadData method, this is where you'll want to clear that out and use: if([BT_fileManager doesFileExistInBundle:bundleFileName]){ //read the configuration data from the project bundle NSString *staleData = = [BT_fileManager readTextFileFromBundleWithEncoding:configurationFileName:-1]; } So far so good...now the tough part. When the code 'loops through all the locations' and adds them to the array of locations in the parseScreenData method you'll need some sort of method to compare the location in the list (each one during the loop) and the location of the phone and no do [self.mapLocations addObject:thisLocation]; online 275 unless the location should show. In other words, this is where the filtering will need to take place. If you add the location with addObject:thisLocation it will show on the map. I have not compared location distances in Objective C before (our solution determines this on the backend) but it can't be that hard. It will be something like the code in layout screen method where it does this over and over again.. //location object CLLocationCoordinate2D tmpLocation; tmpLocation.latitude = [[thisMapLocation.jsonVars objectForKey:@latitude] doubleValue]; tmpLocation.longitude = [[thisMapLocation.jsonVars objectForKey:@longitude] doubleValue]; tmpLocation is a location object. I'm thinking you'll create one of these in the parseScreenData method once for each location, compare it to the devices location (self.mapView.userLocation) and add or not add accordingly. This should explain how to get the distance between two spots (the phone and each location while you load up the data) http://developer.apple.com/library/mac/#documentation/CoreLocation/Reference/CoreLocationDataTypesRef/Reference/reference.html then this: http://stackoverflow.com/questions/6091946/comparing-two-instances-of-cllocationdistance-to-fid-the-smaller-one
 
Zeta_M
Apple Fan
Profile
Posts: 23
Reg: Sep 07, 2011
Aguadilla,Puert...
230
like
10/27/11 01:04 PM (14 years ago)
I still haven't tried your solution but before getting my hands on the whole programming, here is an example of what I want: http://www.appbrain.com/app/pink-spots/com.pinkspots I want to mimic that app for Puerto Rico. If you click on the second print screen you will see the WITHIN 2 MILES part in the NEAR BY section. Will I get that Pretty GUI in buzztouch?
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
10/27/11 02:43 PM (14 years ago)
The GUI you get and the locations you display are up to you.... Maybe consult with a designer? Most screens are made pretty and pro with high quality graphics, not code. Setting a good, well though out background graphic behind common controls like lists and buttons does wonders.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.