Discussion Forums  >  Maps, Device Location, Tracking

Replies: 8    Views: 130

PaddyO
Lost but trying
Profile
Posts: 189
Reg: Sep 11, 2013
Geelong
5,190
10/08/13 12:40 AM (10 years ago)

No tap/callout action or info on map pins - any ideas?

Hi folks, I have map pins loading from a dataURL call to my MySQL database, but there is no callout activity happening (ie nothing happens when I click a map pin in the iOS simulator). Have I missed something that I should have manually added into the config file, or am I not passing the values through correctly? In the control panel I see where I can set up the callout item details if I was adding a map point manually, but when using a remotely called dataset I guess those options somehow need to be incorporated automatically? I'm stuck. I'm not getting error messages, just no action on the pins. Relevant php (kindly debugged/re-written by chris1): ... (preceded by database connection etc) if ($db_found) { $SQL = "SELECT * FROM location WHERE postal_code='60601'"; // note: "location" is the name of the table in the dbase and I'm just using a random zip code to spit out data points $result = mysql_query($SQL); $outputString = '{"childItems":['; $childItemString = ""; $i=0; while ( $db_field = mysql_fetch_assoc($result) ) { // and these are the fields we're pulling out of "location": $i++; $childItemString .= '{"itemid":"location' . $i . '","itemType":"BT_mapLocation","latitude":"' . $db_field["latitude"] . '","longitude":"' . $db_field["latitude"] . '","title":"' . $db_field["name"] . '","subTitle":"' . $db_field["street"] . ' ' . $db_field["city"] . ' ' . $db_field["postal_code"] . '"},'; } $outputString .= fnRemoveLastChar($childItemString, ','); $outputString .= "]}"; echo $outputString; (etc etc.) And in the config file re: the map: {"itemId":"2FCE8AD101DBEDB5D5C33F8", "itemType":"BT_screen_map", "itemNickname":"Mymap", "navBarTitleText":"Mymap", "navBarBackgroundColor":"#33CCCC", "navBarStyle":"solid", "navBarRightButtonType":"refresh", "showUserLocation":"1", "showUserLocationButton":"1", "defaultMapType":"hybrid", "showRefreshButton":"1", "singleLocationDefaultZoom":"25", "dataURL":"http://www.noshplanet.com/full2.php", "childItems":[]}, Any ideas? Thanks!
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
10/08/13 01:25 AM (10 years ago)
Your 'title' field is coming back blank. That might be hindering the callout button from being implemented, I'm not sure. { "itemid": "location1", "itemType": "BT_mapLocation", "latitude": "41.886879", "longitude": "41.886879", "title": "", "subTitle": "233 North Michigan Avenue Chicago 60601" }, Also, a default zoom of 25 is... well, I'm not sure if they go to 25. Usually you'll let it default to around 15, and fine tune it from there. I set mine around 10. I think 18 or 19 is usually the maximum zoom you can use. I'd say zoom it out (like, 8 or 9) until you get it working, and then reset it to something you like once you have proof of concept. Cheers! -- Smug
 
PaddyO
Lost but trying
Profile
Posts: 189
Reg: Sep 11, 2013
Geelong
5,190
like
10/08/13 01:31 AM (10 years ago)
Thanks Smug, sometimes the things right in front of me are things hardest to see! I'll let you know if that's it. From what I understand (very little still!) the default zoom is only relevant when there is a single location being called so with 3 (in this case there are 3 points in the dbase with that zipcode) it shouldn't matter, but.... Cheers Paddy
 
PaddyO
Lost but trying
Profile
Posts: 189
Reg: Sep 11, 2013
Geelong
5,190
like
10/08/13 01:36 AM (10 years ago)
.. and speaking of 'right in front of me' - I just noticed that the lat/long values you put up there are exactly the same.. curious. Guess what? there's no ["longitude"] in my php!! $childItemString .= '{"itemid":"location' . $i . '","itemType":"BT_mapLocation","latitude":"' . $db_field["latitude"] . '","longitude":"' . $db_field["latitude"] . '","title":"' . $db_field["name"] . '","subTitle":"' . $db_field["street"] . ' ' . $db_field["city"] . ' ' . $db_field["postal_code"] . '"},'; How could I have looked at that for a week and not seen it before? Thank you! Maybe with those three things it might start to look a bit better. :)
 
PaddyO
Lost but trying
Profile
Posts: 189
Reg: Sep 11, 2013
Geelong
5,190
like
10/08/13 02:52 AM (10 years ago)
Smug, thank you, that worked. It needed 2 of those 3 fixes: 1. Make sure longitude maps to longitude, not latitude(!); 2. Make sure the title value is pulling data (it was an empty field in the dbase). As far as the zoom goes, it doesn't seem to matter, as the map fits all points drawn from the database query onto a single screen (query event) regardless of how many points there are. Lesson for me here (apart from checking code more diligently) is "If the JSON "title" variable in the Map plugin is drawing its value from an empty cell in the database, it won't generate a callout for that location's map pin." Thanks so much. Cheers Paddy.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
10/08/13 03:33 AM (10 years ago)
Heh, I didn't even notice the latitude/longitude switch. Nice nab. Glad I could help jog the mechanics a bit. Cheers! -- Smug
 
PaddyO
Lost but trying
Profile
Posts: 189
Reg: Sep 11, 2013
Geelong
5,190
like
10/08/13 05:11 AM (10 years ago)
OK, that's fixed thanks to Smug's eagle eyes, but... This is a specific question related to the same thing (map pins > callout bubble) but I think it's maybe indicative of something general that I've missed about the concept of control panel settings vs manually adjusted config data. I'm trying to link a 'tap the callout button' action to another screen (in my case a custom URL). The only place I see to do that is on the control panel for the maps plugin - but I'm calling my data from a dataURL so none of the 3 options in the CP ('Do nothing, don't show an icon', 'Show driving directions' and 'Load the screen with the nickname below...') are 'available' to choose from - they are only options if I'm adding map points manually. So there is no button appearing on my map callout, nowhere for me to enter the name of the customURL screen I want it to link to, and consequently no link to the customURL screen that I can see. There is a line I've found in the 'BT_screen_map.h' file, under the '//map view delegate methods' section, that looks relevant: UIButton *theButton = nil; and I'm guessing that this is where some value other than 'nil' would go if there WAS a button being specified(?) - but I can't find any plugin documentation that says what the options are there or how to activate this button in the config file. So, two questions: 1. How do I show a button in my callout bubble when using a dataURL to generate my map pins? Do I set that in the config file manually, or is there some other place to do it, such as 'BT_screen_map.h'? 2. How do I then create the connection from that tappable (new word!!) button in the callout bubble to another screen? I hope these q's aren't too basic, I'm really trying to get my head around how it all works - thanks everyone for your patience. Cheers Paddy
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
10/08/13 08:22 AM (10 years ago)
It seems like it's doable, if you don't mind playing with it a little... I'm not sure how to show a button, but if you look at the Location Items array format: https://www.buzztouch.com/docs/v1.5/child_locationItems.php You can transition to another screen using loadScreen... If you know the screen you're going to, you can use loadScreenWithItemId or loadScreenWithNickName. If you need to create something dynamically, use loadScreenObject, and the json parameters that go in there would be the information needed for the next screen. You would generate a good bit of this out of your SQL database, CSV file, whatever, using a PHP file called by a dataURL. I did a bit of this once, and although it's not documented too well, it can serve as a little guide on formatting your loadScreenObject information. https://dl.dropboxusercontent.com/u/115208762/loadScreenObject.zip Hope this helps! Cheers! -- Smug
 
PaddyO
Lost but trying
Profile
Posts: 189
Reg: Sep 11, 2013
Geelong
5,190
like
10/08/13 05:18 PM (10 years ago)
Just PM'd you Smug, thanks.
 

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.