New: XDA launches forum for app developers. Discuss coding, tools, marketing, and more.
XDA Developers Android and Mobile Development Forum
Forgot your password?
 
Post Reply+
Tip us?
 
timmymarsh
Old
(Last edited by timmymarsh; 5th December 2010 at 05:32 PM.) Reason: Application now resolved
#1  
timmymarsh's Avatar
Developer Committee / Senior Moderator - Witch Hunt Specialist - OP
Thanks Meter 846
Posts: 4,813
Join Date: Mar 2007
Location: Jersey, UK. Likes: Witch hunts. Dislikes: ibones
Thumbs up [APP] Co-Ordinates Application - Final [updated now for droid too]

Hi All Site Engineers out there,

I had searched for ages to find an app for windows mobile devices that quite simply calculated either new grid co-ordinates from a know point given its bearing and distance or to calculate a bearing and distance given two known points.

I had written a program for a personal computer using (BASIC) but why carry a phone and a computer with you on a building site!

I couldnt find one that was simple, meaning less mistakes when "in the field", so Gino wrote me one. Feel free to download, use and change. Many thanks to GinoAMalone for this simple app, so please donate to either him or XDA of course

The app has a simple home screen giving you 3 choices:

1. New Co-ords Calculator
2. Distance & Bearing Calulator
3. Pythag Calculator

The app is tested on Touch Cruise 6.0 & 6.1, Prophet 6.1. & Blackstone 6.1 & 6.5, Touch Pro & HD2.

Other devices not tested so please give feed back & Screen shots to come.


UPDATE: December 2010: This App has now been written for Android also, please head over to this for info and give thanks to Captainkrtek & Scary Alien
Attached Thumbnails
Click image for larger version

Name:	Screen01.jpg
Views:	378
Size:	13.3 KB
ID:	167090   Click image for larger version

Name:	Screen02.jpg
Views:	345
Size:	18.7 KB
ID:	167091   Click image for larger version

Name:	Screen03.jpg
Views:	279
Size:	18.6 KB
ID:	167092   Click image for larger version

Name:	Screen04.jpg
Views:	220
Size:	13.4 KB
ID:	167093  
Attached Files
File Type: cab Coordinates-1.0.104.CAB - [Click for QR Code] (23.3 KB, 130 views)



 

||GUIDES to common problems | **What XDA Is All About **||

||New Co-ordinates Calculator | Questions & Answers Forum||


Devices: HTC 8x (yh baby) & HD2 - test device

If I Have Helped You, Please donate to XDA Developers

 
GinoAMelone
Old
(Last edited by GinoAMelone; 21st November 2008 at 09:59 PM.) Reason: Fixing broken attachments
#2  
Senior Member
Thanks Meter 44
Posts: 261
Join Date: Jun 2008
Location: Cleveland, Ohio
Default How's this...

Here's a first pass at the app. This sounded like an interesting challenge and something to get me started learning more of WinMo programming. This is my second or third app for .Net. This is written in C# and should only need CF .Net 2.0.

I still need to clean up some rough edges. Right now it doesn't do anything about formatting the output how you requested and most input errors will cause it to crash.

I'm not sure if it's using the same distance algorithms you used. I got my code from http://www.movable-type.co.uk/scripts/latlong.html and http://bryan.reynoldslive.com/post/L...e2c-and-C.aspx. The algorithm I used is called the spherical law of cosines on the first link.

But, let me know if it looks like the sort of thing you need. I'll PM you with my email address.

Thanks,
Gino A...

Update [20 mins later]: I had a boneheaded mistake in the CAB. Fixed now.
Attached Files
File Type: cab Coordinates-0.1.100.CAB - [Click for QR Code] (21.8 KB, 31 views)
File Type: zip Coordinates-0.1.100.zip - [Click for QR Code] (28.7 KB, 17 views)
 
timmymarsh
Old
(Last edited by timmymarsh; 22nd November 2008 at 01:33 PM.) Reason: after thought
#3  
timmymarsh's Avatar
Developer Committee / Senior Moderator - Witch Hunt Specialist - OP
Thanks Meter 846
Posts: 4,813
Join Date: Mar 2007
Location: Jersey, UK. Likes: Witch hunts. Dislikes: ibones
Quote:
Originally Posted by GinoAMelone View Post
Here's a first pass at the app. This sounded like an interesting challenge and something to get me started learning more of WinMo programming. This is my second or third app for .Net. This is written in C# and should only need CF .Net 2.0.

I still need to clean up some rough edges. Right now it doesn't do anything about formatting the output how you requested and most input errors will cause it to crash.

I'm not sure if it's using the same distance algorithms you used. I got my code from http://www.movable-type.co.uk/scripts/latlong.html and http://bryan.reynoldslive.com/post/L...e2c-and-C.aspx. The algorithm I used is called the spherical law of cosines on the first link.

But, let me know if it looks like the sort of thing you need. I'll PM you with my email address.

Thanks,
Gino A...

Update [20 mins later]: I had a boneheaded mistake in the CAB. Fixed now.
Hey Gino,

THanks for the app. have given it a test and come up with error on coords and vector parts:
"latitude value cannot be greater than 90"

ALso suggestion, can you also have metres and millimetres as units too? sounds daft maybe, but if working out bearings and new co-ords for setting out a building units would be in metres or mm. This woud prob explain the latitude error.

Also when im inputting in the bearing how should it be inputted? like this: 95'32'25' ?? or have you done in decimal.

Ok, after thought. I know the reason why the latitude error occurs, its beacuse the co-ords input is in degrees, minutes, seconds. I would need an option for co-ords based in meters for example, easting=500.735 northing=345.321 This is important when calculating results for buildings setting out. Can you please put an option in for this, or even purely base the program in metres/mm rather then degress. Obviously the bearing would still need to be in degree, minutes & seconds.

Thanks Gino, the app looks great and im sure with minor tweaks you will have it running in no time!



 

||GUIDES to common problems | **What XDA Is All About **||

||New Co-ordinates Calculator | Questions & Answers Forum||


Devices: HTC 8x (yh baby) & HD2 - test device

If I Have Helped You, Please donate to XDA Developers

 
khaytsus
Old
#4  
Senior Member
Thanks Meter 610
Posts: 5,869
Join Date: Apr 2008
Location: Central Kentucky
What about a simple GPS related program which allows you to put in waypoints? It'll give you the distance, heading, etc.. Most of them you can also do offsets of X distance and Y heading, etc..

They do not imply having or using the GPS. Generally you turn the GPS on if needed, but you could use the coordinate related stuff without it.
Samsung Note i717 - 4.1.2, CM10 Nightly
Nexus 7 - 4.2.1, Stock Rooted
Try my Alternative XDA CSS Themes (including 2010!)

--
http://theblackmoor.net
http://unlimitedphoto.com
 
timmymarsh
Old
(Last edited by timmymarsh; 22nd November 2008 at 05:20 PM.)
#5  
timmymarsh's Avatar
Developer Committee / Senior Moderator - Witch Hunt Specialist - OP
Thanks Meter 846
Posts: 4,813
Join Date: Mar 2007
Location: Jersey, UK. Likes: Witch hunts. Dislikes: ibones
Quote:
Originally Posted by khaytsus View Post
What about a simple GPS related program which allows you to put in waypoints? It'll give you the distance, heading, etc.. Most of them you can also do offsets of X distance and Y heading, etc..

They do not imply having or using the GPS. Generally you turn the GPS on if needed, but you could use the coordinate related stuff without it.
Khaytsus thanks for your thoughts. I dont think the GPS is the way to go with this. Yes it would calculate distance and bearing, but i need to input grid line references (co-ords) like 500 metres east, 200 metres north. the calculations in my basic code are based on a 2d grid line system. the app would not need to to use gps. Sometimes when working out co-ors or bearing and distance for setting out a building, the distance from 2 given points could be 100 metres but anything as little as 3 metres. GPS may not provide 1mm accuracy.

If my code was used in the app, it would work, i know it does as i have used it many times before. dont think about curvature of the earth or lon & lat think more grid lines like a flat map. see next post for example.



 

||GUIDES to common problems | **What XDA Is All About **||

||New Co-ordinates Calculator | Questions & Answers Forum||


Devices: HTC 8x (yh baby) & HD2 - test device

If I Have Helped You, Please donate to XDA Developers

 
timmymarsh
Old
(Last edited by timmymarsh; 22nd November 2008 at 05:19 PM.) Reason: correction
#6  
timmymarsh's Avatar
Developer Committee / Senior Moderator - Witch Hunt Specialist - OP
Thanks Meter 846
Posts: 4,813
Join Date: Mar 2007
Location: Jersey, UK. Likes: Witch hunts. Dislikes: ibones
Default BASIC - code

Ok my BASIC code below, also attached is a simple (apols) jpeg of what the app should be doing. You will see a red house situated in a grid line system, with its grid co-ords above the relevant point. Hope this is of some help to Gino and anyone else


Code:
To Calc New Co-ords

10 print "New Co-ords"
20 input "Easting=",A, "Northing=",B
22 input "Bearing=",C, "Distance=",D
30 F=sinC*D+A
40 G=cosC*D+B
50 set F4
60 print "Easting 1=";F; "Northing 1=";G
65 goto 22
70 End


To Calc Distance & Bearing

10 print "Bearing & Distance"
20 input "E0=",P,"N0=",Q
30 input "E1=",A,"N1=",B
40 C=A-P
50 V=ABS(C)
60 D=B-Q
70 W=ABS(D)
80 if C=0 then 210
90 if D=0 then 260
100 if C>0 then 160
110 if D>0 then 140
120 E=(ATN(V/W))+180
130 goto 300
140 E=(ATN(W/V))+270
150 goto 300
160 if D>0 then 190
170 E=(ATN(W/V))+90
180 goto 300
190 E=ATN(V/W)
200 goto 300
210 ifD>0 then 240
220 E=180
230 goto 300
240 E=0
250 goto 300
260 ifC>0 then 290
270 E=270
280 goto 300
290 E=90
300 H=(C~2+D~2)~0.5
310 print "Bearing=";DMS$(E)
320 print "Distance=" H
330 End

please note symbol "~" means to the power of (could not find the proper symbol on my keyboard)
also DMS$ = degrees minutes seconds (the new bearing should be displayed in this format, not in decimal)
ATN = (shift tan on sci calculator)
ABS = (shirt LOG on sci calculator)

Pythag Calculation

10 print"Pythag"
20 input "side A=",A,"side B= ",B
30 C=(A~2+B~2)~0.5
40 print "Hyp= ";C
50 goto 10
60 end
Attached Thumbnails
Click image for larger version

Name:	co-ord example.jpg
Views:	85
Size:	24.6 KB
ID:	131820  



 

||GUIDES to common problems | **What XDA Is All About **||

||New Co-ordinates Calculator | Questions & Answers Forum||


Devices: HTC 8x (yh baby) & HD2 - test device

If I Have Helped You, Please donate to XDA Developers

 
khaytsus
Old
#7  
Senior Member
Thanks Meter 610
Posts: 5,869
Join Date: Apr 2008
Location: Central Kentucky
Quote:
Originally Posted by timmymarsh View Post
Khaytsus thanks for your thoughts. I dont think the GPS is the way to go with this. Yes it would calculate distance and bearing, but i need to input grid line references (co-ords) like 500 metres east, 200 metres north. the calculations in my basic code are based on a 2d grid line system. the app would not need to to use gps. Sometimes when working out co-ors or bearing and distance for setting out a building, the distance from 2 given points could be 100 metres but anything as little as 3 metres. GPS may not provide 1mm accuracy.

If my code was used in the app, it would work, i know it does as i have used it many times before. dont think about curvature of the earth or lon & lat think more grid lines like a flat map. see next post for example.
Aha, okay. I was thinking larger scale, less precision, etc. I have to 'deal' with northings and eastings every time I look up benchmark documentation and I always have to figure out how to convert it.. Grid, datum, etc..
Samsung Note i717 - 4.1.2, CM10 Nightly
Nexus 7 - 4.2.1, Stock Rooted
Try my Alternative XDA CSS Themes (including 2010!)

--
http://theblackmoor.net
http://unlimitedphoto.com
 
timmymarsh
Old
#8  
timmymarsh's Avatar
Developer Committee / Senior Moderator - Witch Hunt Specialist - OP
Thanks Meter 846
Posts: 4,813
Join Date: Mar 2007
Location: Jersey, UK. Likes: Witch hunts. Dislikes: ibones
Hi Guys,

Any updates? Please dont think im impatient, im certainly not, just willing to help in anyway i can

Regards.



 

||GUIDES to common problems | **What XDA Is All About **||

||New Co-ordinates Calculator | Questions & Answers Forum||


Devices: HTC 8x (yh baby) & HD2 - test device

If I Have Helped You, Please donate to XDA Developers

 
GinoAMelone
Old
#9  
Senior Member
Thanks Meter 44
Posts: 261
Join Date: Jun 2008
Location: Cleveland, Ohio
Quote:
Originally Posted by timmymarsh View Post
Hi Guys,

Any updates? Please dont think im impatient, im certainly not, just willing to help in anyway i can

Regards.
I didn't get as much time last weekend to make progress as I hoped. I did do some cleanup of the UI and add several more units. I believe there are no more circumstances where poorly formatted input causes crashes. I also eliminated the "calculate" button and have it calculate whenever enough info is available. The biggest motivator for this was so the UI works fine with a SIP open.

I still need to look at formatting the output and spend some time with your algorithm.

Thanks for the challenge. this is working as an excellent vehicle for me to learn about .Net CF programming.
Attached Files
File Type: cab Coordinates-0.1.101.CAB - [Click for QR Code] (21.3 KB, 17 views)
 
fx17
Old
#10  
Member
Thanks Meter 0
Posts: 50
Join Date: Aug 2008
try G7toCE

http://www.gpsinformation.org/ronh/

this javascript page will run offline in PIE

http://williams.best.vwh.net/gccalc.htm


XDA PORTAL POSTS

Responses From Ubuntu Pouring Into Ubuntu Touch Q&A Thread

Ubuntu has become the most successful *nix distribution for a number of reasons, … more

Heimdall Suite 1.4.0 Released

The release version of Heimdall Suite 1.4.0 is now available after an epic wait. You may remember hearing about … more

A Guide to Paid Work on XDA-Developers

For the longest time, XDA has been a bastion, a pillar in the world of development. This is … more