Iron Speed Technical Forums
Register Latest Topics
 
 
 


Reply
  Author   Comment  
pinbot

Avatar / Picture

MVP Consultant
Registered:
Posts: 952
Reply with quote  #1 

Add GeoLocating to your Mobile Iron Speed Application

Bryan Patrick –Pseudo Consulting

April 10, 2012

 

Introduction

Iron Speed added some great features with Version 9, especially generating Mobile Applications.  Since most mobile phones have built-in GPS location, utilizing that information adds even more value to your application.

Here is way to add “Geolocating” to an Iron Speed application and use that information to provide information to the user based on their current location.

You can see this application in use at http://closest.alndata.com

 

Implementation

First off we need some data.  In one of my databases, I have apartment information with GPS coordinates for over 21,000 apartment communities around the United States.

Here are the steps I used to create a test application that will display up to the 50 closest apartment communities to you along with the distance from you to them.  This is just a sample application.  In a real-world application, you would display more information about the properties, driving direction, or  could display a map of the closest properties.

 

Step 1:   Create a view in your database that has 3 columns.  An Id column, a Property Name column and a Distance column.  We are not actually going to use this view.  At run-time we will replace the data from the output of a stored procedure.  The view is just to create a table control in your mobile Iron Speed application.

Step 2:  Add a drop down list for the Property Count, a Latitude textbox, a Longitude textbox and a “Go” button.

 

 

Step 3:  Right-Click and add the following code to your page directives:

 

This code will cause your phone to load your current GPS coordinates into the 2 textboxes.  The first time you hit your application’s page you’ll get the notice from your phone that your browser is trying to access your curent location.

 

 

Be sure to “Allow” your browser to access your location information.

 

Step 4:  Add a ShowTable for your view.  Hide the Drop-Down icon and Pagination controls.  I set the page length to 100 to handle all possible values from my “count” control.  For the fields, I selected the AptName field and Distance.  Again, the view itself is not being using to generate data.  We are going to call a stored procedure and “Add Rows” ourself to the displayed data in order to display the information.

Step 5:  Set the properties for the “Show Closest Properties” button to apply the search and filter to the view’s TableControl.

 

 

 

Step 6: We need some data!  Here is my stored procedure which, given a GPS location and count N, returns the N closest properties in order of distance.

 

Step 7:  Now we just need to tie it all together.  We can modify just 1 function of the TableControl, the LoadData() function.

Modify the LoadData() function removing these 2 lines:

 

 

And replacing them with the following:

 

 

These changes check for some input values, pass them to the stored procedure, then add rows in our TableControl for each record retrieved from the stored procedure.

 

How it looks

Here are actual screen captures from my iPhone 4 after lunch today:

 

 

 

 

 

 

 

Conclusion

Adding location services can greatly enhance your Iron Speed mobile application.  With some javascript and overriding the LoadData() function, it’s fairly easy to implement.

 

About the Author

C. Bryan Patrick II has been a professional database developer since the age of 16.  He has a Bachelor of Arts in Computer Science from The University of Texas at Austin.  At 26 Bryan received a US Patent (# 5,142,624) for work done during his college years.  He is a member of the Microsoft Partner Program and has been self-employed for the last 10 years as a small business IT consultant and web application developer.

Attached Images
Click image for larger version - Name: image001.png, Views: 1381, Size: 15.00 KB  Click image for larger version - Name: image003.png, Views: 1369, Size: 101.05 KB  Click image for larger version - Name: image006.png, Views: 1361, Size: 12.68 KB  Click image for larger version - Name: image004.png, Views: 1357, Size: 39.29 KB  Click image for larger version - Name: image002.png, Views: 1364, Size: 27.10 KB  Click image for larger version - Name: image005.png, Views: 1357, Size: 28.36 KB  Click image for larger version - Name: image007.png, Views: 1361, Size: 90.91 KB  Click image for larger version - Name: image008.png, Views: 1360, Size: 51.31 KB  Click image for larger version - Name: image009.png, Views: 1358, Size: 46.45 KB 

__________________
C. Bryan Patrick II
Iron Speed Designer MVP Consultant
Pseudo Consulting

JimiJ

Avatar / Picture

MVP Developer
Registered:
Posts: 1,948
Reply with quote  #2 
It looks good and nice added value to phone apps!
__________________

  Jaime Jegonia
[jts_logo]

Iron Speed MVP Developer
 

". . . and whoever sows generously will also reap generously" 2 Cor 9:6

pinbot

Avatar / Picture

MVP Consultant
Registered:
Posts: 952
Reply with quote  #3 

Thanks Jaime!

It turned out to be easier than I thought it would.



__________________
C. Bryan Patrick II
Iron Speed Designer MVP Consultant
Pseudo Consulting
porphi

Registered:
Posts: 647
Reply with quote  #4 

Bryan,

      I understand the point is to demostrate the integration of lat/lon from a mobile device but correct me if I’m wrong but the mileages are as the crow flys not actually highway miles?  Just in case someone tries to use this and expects actually milage.


__________________
Thank you,
Phil Porter
PPG&A, INC.
pporter@ppgainc.com
http://www.ppgainc.com
https://rapidsprout.com
678-362-2035
pinbot

Avatar / Picture

MVP Consultant
Registered:
Posts: 952
Reply with quote  #5 
Yes.  The formula is the distance between two points, not actual driving miles.

For actual driving miles, you'd probably have to make some API call to Google or Bing Maps and have it actually map it first, summing up all the roads traveled.

__________________
C. Bryan Patrick II
Iron Speed Designer MVP Consultant
Pseudo Consulting
porphi

Registered:
Posts: 647
Reply with quote  #6 

Bryan,

                That might save someone some time.  There are also more accurate options besides google and bing when detailed mileage is needed in a contractual situation.


__________________
Thank you,
Phil Porter
PPG&A, INC.
pporter@ppgainc.com
http://www.ppgainc.com
https://rapidsprout.com
678-362-2035
pk_davidson

Registered:
Posts: 223
Reply with quote  #7 

Very nice Bryan!


__________________
Paul
Mapletree

Registered:
Posts: 19
Reply with quote  #8 
Porphi, what would these more accurate means be?  They may be of use to me.  Thanks.
bpangtay

Registered:
Posts: 57
Reply with quote  #9 
1. What would be the recommended method to display the closest locations as markers on a Google Map?

I am expanding on the article: http://www.databasezone.com/samples/isdmap/index.html.

2. How would I create the markers so that a user can click on a marker to edit that particular record in IronSpeed?


Thanks for your assistance.

zeeman73

Registered:
Posts: 44
Reply with quote  #10 
Hi.
    how if i just want to capture the latitude and longitude of my current location to a mobile form?
Thanks
aa0708198

Registered:
Posts: 11
Reply with quote  #11 
Hi All,

Any one help me I just to save a browser location only in my database can any one help me on this I am new in iron speed. And I have not much idea.

__________________
AK

Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Download Iron Speed Designer

Terms of Service Privacy Statement