Discussion Forums  >  Maps, Device Location, Tracking

Replies: 9    Views: 94

Alessandro
Aspiring developer
Profile
Posts: 68
Reg: Nov 13, 2012
São Paulo
12,180
01/23/16 05:03 AM (1 year ago)

Map plugin options | Import location data | dataURL pull content

I'm working on a new version of my app, it uses free David's Location Map plugin. For the new version I will input much more locations (may reach a total of 500 in separated maps for each city) and I'm trying to figure out the best option and the best map plugin for implementing this.

In the map, when user taps a pin it will load an external url that will have further details and photos of this location. To implement this in Location Map plugin, the option I use is to create a Custom URL plugin screen for each location. For the amount of locations I will have in the app it will, I'd like to know if there's an easiest way to implement this.

These are my doubts:

1) In the other payed map plugins available (Spot Finder, Smug's Offline Map kit) is there an option to create the location and enter an external url directly without the need to create a Custom URL plugin screen? It should also show user's location.

2) As I have the location listed in a Google Apps Sheet, is there a way to transport this data to the app without the need to insert each location through the map plugin page? I thought in converting this data in to a code, I could do it easily in this sheet, but I don't know how should be this code to convert it.

3) I was trying to figure out how use dataURL to pull content from this Google Apps Sheet but unfortunately my development skills are not enough to understand how to do it. The data to be read would be only few: name, address, longitude/latitude and external url. Does this option adds delay to load the locations in the map?

Thanks!
 
SmugWimp
Smugger than thou...
Profile
Posts: 6249
Reg: Nov 07, 2012
Tamuning, GU
80,740
like
01/23/16 06:01 AM (1 year ago)
well, any 'pull' from a server will create delays. good connection, low delay time. it's all variable, because everyone will have different speed access. However, it's usually good enough; millions of apps do this.

more records (ie, locations) also add time. But again, we're talking (hopefully) milliseconds, not minutes or hours.

I'll say this about 'my' plugin; the *only* thing it does that the free BT plugin can't do, is display offline maps. If you're going to be pulling from a server, then the app will have to be online, so if you haven't bought my plugin, there isn't much reason to... at least, for this project.

That said, the 'integration' of server to plugin is pretty similar, so if you haven't checked out the 'WB_addOns' that Susan/David put together (and I host a copy with some additional files) you might want to take a look:

https://www.marianasgps.com/public/wb_addons.zip

check out the scripts used; regardless of 'where' your data comes from, you're going to process via php for the most part, and those contain some good useful methods that work great with MySql.

Although I'm not familiar with the Google App Sheet, if it's anything like excel, you might want to look at my Smug JSON Converter, which you can paste in a spreadsheet, and get a JSON childItem file as a result.

https://www.marianasgps.com/public/sjcon.zip

If none of that helps, get a bit more specific about the format you're coming from, and we'll see if we can't figure something out.

Cheers!

-- Smug
 
Alessandro
Aspiring developer
Profile
Posts: 68
Reg: Nov 13, 2012
São Paulo
12,180
like
01/23/16 06:35 AM (1 year ago)
Hi Smug,

Many thanks for the details, I will study the info you sent, surely a very helpful guide.

Probably offline maps for this project are not needed, thanks for explaining the additional feature comparing to the free BT map plugin.

Thanks!
 
SmugWimp
Smugger than thou...
Profile
Posts: 6249
Reg: Nov 07, 2012
Tamuning, GU
80,740
like
01/23/16 07:54 AM (1 year ago)
FYI, I've created a couple of videos you may (or may not, lol!) find useful.

Smug JSON Copy: https://www.youtube.com/watch?v=piFoxiR3Omw

WB_addOns: https://www.youtube.com/watch?v=7s2h9x30loc

Various others: https://www.youtube.com/smugwimp (Not all of them are BT related)

Cheers!

-- Smug
 
Alessandro
Aspiring developer
Profile
Posts: 68
Reg: Nov 13, 2012
São Paulo
12,180
like
01/25/16 04:23 AM (1 year ago)
Yes, very helpful videos! The examples you showed in these videos is exactly what I'd like to accomplish.

Due to my limited development skills, I'm not sure if I will be able to work with sql and WB_addOns, despite your detailed explanation in the video. But I will study that.

To work with WB_addOns should the whole app be self-hosted? Or could I maintain it hosted in BT and use the Screen Data Url field there? The idea is to accomplish the same you showed in the example in the video, depending on the location selected it loads a Custom URL page but with data related to the selected location.

Thanks again!
 
SmugWimp
Smugger than thou...
Profile
Posts: 6249
Reg: Nov 07, 2012
Tamuning, GU
80,740
like
01/25/16 08:12 AM (1 year ago)
Well, fortunately both BT and the internet are rather flexible... there are a variety of solutions that could possibly work for you...

The reason 'most' people do it self hosted, is we're already paying for webspace running a website or two, and when it comes down to basics, 'bt self hosted' is nothing more than a complex website, on par with Wordpress or Joomla, etc... In other words, a set of custom crafted PHP pages for the pure purpose of configuring, displaying, and accessing your mobile app 'config data', similar to WP or Joomla being custom crafted PHP pages for the pure purpose of configuring, displaying, and accessing Web Content. So, if you already have a domain, host, and website, then BT Self hosted is no worse to install and configure than any standard CMS package. A few particular details, but for the most part, no biggie.

But, because it's the internet, you can have (again, depending on the config) a few pieces here, a few pieces there. Remember, the 'dataURL' is exactly that. a URL. and whether it points to BT, your server, the Whitehouse, whatever... 'electronically' it's all the same thing; an Address to grab stuff with a reasonable expectation to obtain the information in a particular format. The protocol (client/server communication language) usually prepends the address (ie http, ftp, nntp, etc...) and the format is usually the suffix of the filename (txt, html, php, etc...).

Now, that 'stuff' can be information from a database, from a 'flat text file', or perhaps some other source. It doesn't 'have' to be any one source either. You could feed 'this' plugin from a php connected database, you can feed 'that' plugin from a flat file...

As long as it is in a way that 'you' can manage it, who really cares?

That being said, there are a couple of things to consider:

1) WB_AddOns isn't much more than a 'BT Friendly' set of MySQL database 'templates' and 'php scripts'. They 'will' require a server somewhere. Again, if you run any kind of website, then chances are you already have the server resources; most hosting packages come with "AMP" (Apache, MySQL, PHP) which is what you'll need to run any CMS, including BT Self Hosted. So, WB_AddOns isn't really more than a 'working template' to get people accustomed to modifying php files to suit their own particular needs. Hard to find a 'one size fits all' product for mobile.

2) If you have a place to 'park' flat text files, such as a cloud drive that has external URL Access, you 'might' be able to use that, provided there are no dynamically generated URLS. It is strongly suggested however, that you 'NOT' utilize free cloud storage services such as 'dropbox' for your apps. Dropbox has been known to 'shut down' accounts that exceed the parameters placed on free agreements, and as such, has bitten more than one developer in the behind. But if you use a paid service, you 'might' be able to use it; you'll have to check your agreements. Take a look at the FAQ section of your desired solution to be sure.

3) I suppose you 'could' upload files to BT (in the control panel file manager). I'd check with David first so that you don't bite the hand we butter our bread on. or something. Ask David. If you use this as an option, you'd be limited to flat text files.

So with this information, you can go database, flat file, or a combo of the two.

Frankly, the database solution (whether mysql, or other database) is by far the most flexible and easiest to work with. Once you have one page working, it's a snap to make small changes to accommodate additional pages or formats to deliver your data.

If you're relegated to using 'only' flat text files, you'd be best served to somehow find a way to automate the creation of those files; there will probably be a LOT of them.

I have two clients that utilize my 'web services'. I give them webspace and email for $100 a year. For a company with no IT staff, that's a drop in the bucket. a half decent hosting package will run roughly $150 per year. That should give you all the bells and whistles, with unlimited space. So they pay me $50 more than I need for my hosting needs, and I get to do additional crap with no additional outlay. Oh, and when they have problems, I've provided them the hosting companies Support Number, so unless something really bad happens, I never get called. You might consider something similar if possible.

Let me know if this helps. I'm sure it may generate more questions. No problem. Fire at will.

Cheers!

-- Smug
 
Alessandro
Aspiring developer
Profile
Posts: 68
Reg: Nov 13, 2012
São Paulo
12,180
like
01/25/16 09:25 AM (1 year ago)
Hi Smug,

Following your video instructions I was able to populate the map from Screen Data URL! Many thanks!

https://drive.google.com/file/d/0B1xSc1EgMvIydGpNb3kyMnlGdWc/view?usp=sharing

I converted the data from the Google Apps spreadsheet into a text file and uploaded it to the Internet and referred it in the Screen Data URL. I created a formula in the spreadsheet that generates the code with the childItems, the same result that you explains using the Json Coverter but a different method.

The locations load really fast in the map, I tested with about 30 locations in a map, in the final app version I believe there will be not more than 200 locations per map. I tested hosting the flat file in my server and also in BT file manager, both worked fine.

Now I will adventure myself into the next level, will take a few days for me to learn how to implement the database structure you taught in the second video. This would be to open a screen that shows details of the location by tapping its pin in the map. You're right, using flat files for this would need too many files to be uploaded.

Considering your explanations, I will then proceed with the option to maintain my app hosted in BT and only refer to the database that I will host in my server.

Many thanks!

Alessandro.
 
Red Dog
buzztouch Evangelist
Profile
Posts: 805
Reg: Jun 16, 2011
Southern Califo...
18,800
like
01/27/16 10:02 PM (1 year ago)
Hi Smug'

Enjoyed your detailed video.
Question; Since BT_Maps supports Red, Green, and Purple map pin colors, can we add a "pincolor" table in the sql table, and a "pincolor" column in the csv file to specify the map pin color for different addresses?

Or would there need to be more code changes involved?

Thank you.
 
Alessandro
Aspiring developer
Profile
Posts: 68
Reg: Nov 13, 2012
São Paulo
12,180
like
05/31/16 06:22 AM (1 year ago)
Hi Red Dog,
I tested the "pincolor" in the MySql database and it works. You can define in the database a different pin color for each row entry.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6249
Reg: Nov 07, 2012
Tamuning, GU
80,740
like
05/31/16 10:59 PM (1 year ago)
Barry,

So sorry I missed your question! I'm not sure how or why, but I'll blame age and plead mea culpa, lol!

Yes you can do that, and as Alessandro mentioned, it works pretty easily. Just remember that BT Code only accomodates those colors. If you wish to use a different color, you might replace the "If" code to reflect this, starting around line 690 of 'BT_screen_map.m':

//we may have set a custom color for this location's marker...
/*
if([[BT_strings getJsonPropertyValue:tmpLocation.jsonVars nameOfProperty:@"pinColor" defaultValue:@""] isEqualToString:@"green"]) [annotationView setPinColor:MKPinAnnotationColorGreen];
if([[BT_strings getJsonPropertyValue:tmpLocation.jsonVars nameOfProperty:@"pinColor" defaultValue:@""] isEqualToString:@"purple"]) [annotationView setPinColor:MKPinAnnotationColorPurple];
if([[BT_strings getJsonPropertyValue:tmpLocation.jsonVars nameOfProperty:@"pinColor" defaultValue:@""] isEqualToString:@"red"]) [annotationView setPinColor:MKPinAnnotationColorRed];
*/
NSString * myPinColor = [BT_strings getJsonPropertyValue:tmpLocation.jsonVars nameOfProperty:@"pinColor" defaultValue:@""];
switch (myPinColor) {
case @"green":
[annotationView setPinColor:MKPinAnnotationColorGreen];
break;
case @"red":
[annotationView setPinColor:MKPinAnnotationColorRed];
break;
case @"purple":
[annotationView setPinColor:MKPinAnnotationColorPurple];
break;
case @"":
break;
default:
UIColor *myTmpColor = [BT_color getColorFromHexString:myPinColor]
[annotationView setPinColor:myTmpColor];
break;
}

and although it's untested, it 'should' work. If not, let me know.

*be sure* if you're going to specify a color other than the 'standard', use a hex code, such as #123456, as that is how it converts the color. I don't think those are options in the Control Panel, so you may have to manually edit the json for it to work.

Cheers!

-- Smug
 

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.