Announcement

Collapse
No announcement yet.

Distance

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Distance

    I'm looking for some solution to calculate the distance based on CURENT LOCATION and some remote location. This is very much like the GPS calculates how far it is to the destination. It doesn't have to be a real time( static location TO static location is fine). I just need to enter 2 addresses and find the distance. Any ideas on how to implement it in a SC project ?


    Arthur
    -----------------------------------------
    Arthur Klisiewicz
    dATA POINT SOFTWARE
    www.datapointsoftware.com

  • #2
    Originally posted by aka View Post
    I'm looking for some solution to calculate the distance based on CURENT LOCATION and some remote location. This is very much like the GPS calculates how far it is to the destination. It doesn't have to be a real time( static location TO static location is fine). I just need to enter 2 addresses and find the distance. Any ideas on how to implement it in a SC project ?


    Arthur
    Yes, implement googlemaps in a blank application and call that. With the GoogleAPI you have a lot of options to calculate distance. Based upon some data you retrieve long/latt coordinates of both locations. These are input for the several api's. I've got no working app as I have been investigating it, but finding long/latt is a piece of cake.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      Albert - it it is a piece of cake (and for a smart soul as yours will take only few seconds) why not make an example and share it ?
      or perhaps make it a topic for your next webinar (which I enjoy)

      Arthur
      -----------------------------------------
      Arthur Klisiewicz
      dATA POINT SOFTWARE
      www.datapointsoftware.com

      Comment


      • #4
        Hope this is helpful, i posted the lo/la routine at your other post so you don't need geodatasource. This is from the web btw, I kept the legal rights into the routine. The routine is fairly simple and follows the theorie you can find here: http://www.movable-type.co.uk/scripts/latlong.html

        I don't mind doing webinars like the one I did, but they cost an awful lot of time which I don't have currently. We earn our money by developing (not being a reseller ;-))

        Code:
        <?php
        	 
        	/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
        	/*::                                                                         :*/
        	/*::  This routine calculates the distance between two points (given the     :*/
        	/*::  latitude/longitude of those points). It is being used to calculate     :*/
        	/*::  the distance between two locations using GeoDataSource(TM) Products    :*/
        	/*::                                                                         :*/
        	/*::  Definitions:                                                           :*/
        	/*::    South latitudes are negative, east longitudes are positive           :*/
        	/*::                                                                         :*/
        	/*::  Passed to function:                                                    :*/
        	/*::    lat1, lon1 = Latitude and Longitude of point 1 (in decimal degrees)  :*/
        	/*::    lat2, lon2 = Latitude and Longitude of point 2 (in decimal degrees)  :*/
        	/*::    unit = the unit you desire for results                               :*/
        	/*::           where: 'M' is statute miles (default)                         :*/
        	/*::                  'K' is kilometers                                      :*/
        	/*::                  'N' is nautical miles                                  :*/
        	/*::  Worldwide cities and other features databases with latitude longitude  :*/
        	/*::  are available at http://www.geodatasource.com                          :*/
        	/*::                                                                         :*/
        	/*::  For enquiries, please contact sales@geodatasource.com                  :*/
        	/*::                                                                         :*/
        	/*::  Official Web site: http://www.geodatasource.com                        :*/
        	/*::                                                                         :*/
        	/*::         GeoDataSource.com (C) All Rights Reserved 2015                  :*/
        	/*::                                                                         :*/
        	/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
        	function distance($lat1, $lon1, $lat2, $lon2, $unit) {
        	 
        	  $theta = $lon1 - $lon2;
        	  $dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) +  cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta));
        	  $dist = acos($dist);
        	  $dist = rad2deg($dist);
        	  $miles = $dist * 60 * 1.1515;
        	  $unit = strtoupper($unit);
        	 
        	  if ($unit == "K") {
        	    return ($miles * 1.609344);
        	  } else if ($unit == "N") {
        	      return ($miles * 0.8684);
        	    } else {
        	        return $miles;
        	      }
        	}
        	 
        	echo distance(32.9697, -96.80322, 29.46786, -98.53506, "M") . " Miles<br>";
        	echo distance(32.9697, -96.80322, 29.46786, -98.53506, "K") . " Kilometers<br>";
        	echo distance(32.9697, -96.80322, 29.46786, -98.53506, "N") . " Nautical Miles<br>";
        	 
        	?>
        Last edited by aducom; 01-28-2015, 05:21 AM.
        Albert Drent
        aducom software netherlands
        scriptcase partner, reseller, support and (turn-key) development
        www.scriptcase.eu / www.scriptcase.nl

        Comment


        • #5
          Yes Albert I agree and I understand.
          I'm a member of another forum (for Android). They way the company deals with this that they offer inscentives for those who create webinars, tutorials, videos etc in form of discounts for updates, free updates, access to extra libraries and features. Something that should be considered long time ago with Net Make. This way their product, support, forum and documentation THRIVES ! The company is based in Israel - so prhaps the reason is that those people have balls for making the business the right way and users love it. I'm really happy with what they offer in sense of product, support and documentation. It does not even compare with NetMake and despite they all speak Jewish - have no problem with English at all.

          Art
          -----------------------------------------
          Arthur Klisiewicz
          dATA POINT SOFTWARE
          www.datapointsoftware.com

          Comment


          • #6
            Can you please share an example App when you implement this ?
            Art
            -----------------------------------------
            Arthur Klisiewicz
            dATA POINT SOFTWARE
            www.datapointsoftware.com

            Comment


            • #7
              A little bit of googling will help a lot:
              http://stackoverflow.com/questions/1...ing-google-api
              Be aware that it is the distance matrix so it uses the distance via the roads, not the geographical distance. For that you need another api call.

              Comment


              • #8
                Hi Art, the code I posted is directly from our sources and you can implement that in an event or other. The distance code is just a call and return value so actually I don't know what to do to help you. Regarding the other 'issue' as a reseller I could request for a free licence and actually I have one in my account. But we are and want to stay independent from scriptcase so we are using our own payed licences and do not use the 'free one'. We have no intention to change that. We do webinars, but in Dutch, in fact there will be one in march to come.
                Albert Drent
                aducom software netherlands
                scriptcase partner, reseller, support and (turn-key) development
                www.scriptcase.eu / www.scriptcase.nl

                Comment


                • #9
                  I liked your presentations, so why not to get more audience and do it in English ?

                  Arthur
                  -----------------------------------------
                  Arthur Klisiewicz
                  dATA POINT SOFTWARE
                  www.datapointsoftware.com

                  Comment


                  • #10
                    Originally posted by aka View Post
                    I liked your presentations, so why not to get more audience and do it in English ?

                    Arthur
                    In my case, I'm not accostumed to talk English. I can try to write English and I understand reading it, but sometimes is very difficult to express what I have on my mind, and more if is a live event, where people can ask doubts in real time. My English is something like "Hau, I am dark horse from the Comanche tribe"
                    /Giuseppe

                    Professional Scriptcase Services
                    Some Customers opinions

                    Comment


                    • #11
                      Arthur,

                      I'm sure you know the reason.

                      To do a webinare you need to have (a lot of) time for preparation, the webinar itself etc. I have over 3000 posts here all volunteerly. Perhaps not all are right but they are of more value than 'sent to the bugsteam'. They cost me pretty much time. I did a webinar for SC but there's no aducom on the title, but scriptcase. There's no value for me there. I haven't been selling more licences because of that. Nor additional development requests. It's just time consuming. I think that I have reached the limit of my volunteerly job. You don't believe the amount of private email I get and I had to stop replying to my pm's and email. I like to help people out and I have a great interest of building a user community. But I simply don't have more time to spend, we need to make money too.

                      That's why I am focussing our webinars efforts on the markets we manage. Don't forget, besides the time effort there's are costs too. Every webinar needs a 3rd party for management and that's not cheap. Of course we could ask money for the webinars, but I doubt if the interest would be large enough to even come out of the costs.

                      In general, we are a customers of scriptcase, not a sponsor. And as I wrote before, we have no intention to change that. Our main business is software development.
                      Albert Drent
                      aducom software netherlands
                      scriptcase partner, reseller, support and (turn-key) development
                      www.scriptcase.eu / www.scriptcase.nl

                      Comment

                      Working...
                      X