Discussion Forums  >  Uncategorized

Replies: 6    Views: 265

nilayp
Code is Art
Profile
Posts: 9
Reg: Apr 29, 2011
San Francisco, ...
90
05/01/11 09:41 AM (14 years ago)

1.5 Question - can I apply a filter to map data for the location screen?

First - let me say I am loving Buzztouch. What you guys have put together is awesome! I'd like to know if its possible to filter a dataset and plot them on a map? Let's say I was building an app to show the location of stores in the local area; I might ask the user: What kind of clothing are you looking for: Mens/Womens What type: Casual/Elegant What price: Inexpensive/Designer Then, based on these answers, I would show a filtered set of stores on the location map. Make sense? Some questions 1) Is the HTML/Text screen the best one to ask the questions? 2) Let's say it is... When the user pushes the submit button, can I redirect the iPhone screen to the location map? 3) Can the answers be injected into the location map's Data URL? I'm well versed in web programming, so putting together the HTML/CSS/Javascript for the questions page & the data URL backend I can do rather quickly. If it can't be done natively in BuzzTouch, I suppose I can export the project and code the questions screen in Objective C, right? I've done very little ObjC code, but I guess I have to learn sometime. :) Thoughts? Thanks in advance. -- Nilay
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
05/01/11 10:19 PM (14 years ago)
thanks for the kudo's...glad you're impressed! So, this is totally doable and is being used by lots and lots of folks. The idea is this: You provide the map locations from a URL. Your URL (.PHP probably) outputs a JSON formatted list of locations. Before writing the output it filters the list by a certain distance. 'Grab the locations from the database, loop through them, if they are within a certain range, output them' The range, and the lat/lon is passed from the phone in the querystring so the .PHP script knows where the phone is. There is a long discussion about this here, and some sample code. For somebody with some skill it's very very easy. http://www.buzztouch.com/forum/thread.php?tid=65181E4ADF97874B08E6D2B
 
nilayp
Code is Art
Profile
Posts: 9
Reg: Apr 29, 2011
San Francisco, ...
90
like
05/01/11 10:58 PM (14 years ago)
David, Thanks for the quick response. I had read the previous thread re: filtering by lat/lon. What if I want to filter on other criteria besides lat/lon? Criteria that the user specifies before they are taken to the map? Is there a way to pass these on the query string to my URL? Or is it hard coded to only pass lat/lon and range? Thanks, again.
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
05/02/11 12:00 AM (14 years ago)
Ah...I misunderstood. OK.. so UGC (user generated content) is a tougher matter because you have to a) gather the data (filter conditions) then... b) Pass them to the script on your backend.... c) display the results on the map... There are no values hard coded anywhere. The values passed to the map come directly from the dataURL in the map's advanced properties. To get the lat/lon/device model/deviceId/userId (if logged in) you use merge fields in the dataURL. http://www.mysite.com/mapdata.php?lat=[deviceLatitude]&lon=[deviceLongitude] would become http://www.mysite.com/mapdata.php?lat=38.44433&lon=-119.33433 So, you could append anything you want to the end of the URL after whatever merge fields you want the app to send your script. This would work if you had a set list of searchable items. Like links to maps for 'Gas' 'banks' 'schools' You would make a map screen for each type but all your map screens would use the same dataURL. The only difference in your map screens would be the querystirng values. Like... http://www.mysite.com/mapdata.php?lat=[deviceLatitude]&lon=[deviceLongitude]&serach=bank http://www.mysite.com/mapdata.php?lat=[deviceLatitude]&lon=[deviceLongitude]&serach=school http://www.mysite.com/mapdata.php?lat=[deviceLatitude]&lon=[deviceLongitude]&serach=gas This would work well if you had buttons or menu items for each type but still does not solve the user ENTERING values to search on (not choosing from a list). This is another matter. Does this help? There are no screens today that allow user-entered values to be appended to the URL. Would not be hard to create your own screen to do this... just not included in the standard list. Let us know if you want to attempt this ;-)
 
nilayp
Code is Art
Profile
Posts: 9
Reg: Apr 29, 2011
San Francisco, ...
90
like
05/02/11 05:40 PM (14 years ago)
In your search=bank example above, you are suggesting that I append each attribute/value pair to the query in the ObjectiveC code, correct? Perhaps in the downloadData method of BT_screen_map? (or before it is called somewhere?) And... for our own screen... your recommendation is to build it in Interface builder & just wire it together in front of the map view? Correct? Just wanted to get a sense for what you would do... We are definitely going to try... You've been warned. :) Thanks for your help! -- Nilay
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
05/02/11 10:31 PM (14 years ago)
I wouldn't append anything in the Objective C, I would append the variables to the dataURL properties in the Advanced Settings of a screen (control panel). Example: Menu item 1 leads to a map screen with: http://www.yousite.com/mapdata.php?search=bank Menu item 2 leads to a map screen with http://www.yousite.com/mapdata.php?search=atm The mapdata.php page would power both map screens but would output different values because of the search conditions, the value in the querystring.
 
nilayp
Code is Art
Profile
Posts: 9
Reg: Apr 29, 2011
San Francisco, ...
90
like
05/03/11 08:31 AM (14 years ago)
David, Okay, I understand the simple case. This can be done in the control panel directly. What about the complex case where I capture UGC & submit that to the dataURL of the map screen? I understand that I can't do this using the Buzztouch control panel, correct? If not, in the Xcode project, I am going to use interface builder to create a new screen which asks for this content, capture it in a way where I can insert the user's answers into the dataURL querystring... so when the map loads, the filtered json data it receives takes into account the UGC. This is the best way to code up the project?
 

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.