Calculation of the distance of the location GPS provider

I'm looking to develop an application of GPS based location by saving a LocationListener with the LocationProvider, I need to be able to calculate the distance between two cooridinates.

The Coordinates () .distance method doesn't seem to work, also responds to 0.

I saw and distance example where speed and range were used to calculate, but I was wondering is this reliable?

An alternative is to calculate the distance between two coordinates using the Haversine formula, the java class Math in Blackberry JDE however does not have the required operation atan2. Anyone know of any alternative?

Thank you

Dave

In my experience, the distance calculation works.  What results are you seeing?  Are you sure these two places are valid?

I would not use speed and interval unless there is no other choice, or that the interval was small.

The quesiton on atan was invited to this forum, have a search for her.  Here is an answer:

BB has no ACON, ATAN, ASIN

http://supportforums.BlackBerry.com/Rim/Board/message?board.ID=java_dev&message.ID=142&query.ID=2195...

Tags: BlackBerry Developers

Similar Questions

  • Why my GPS stopped suddenly when the location and the surroundings have not changed work?

    Why my GPS stopped suddenly when the location, a framework and the weather conditions have not changed work?

    Ros

    iPhone 4S OS 9.2.1

    Have you ever tried to force reboot the phone by holding down the button sleep and home for 10 seconds, until the Apple logo comes back again? You won't lose data by doing this, but it can cure a few glitches.

    If this does not work and to rule out a software problem, set it back to factory settings, without using any data backup later. Test the phone and if the GPS works again, restore the backup.

    If the GPS does not work after the factory reset, it is a hardware problem, and Apple has to repair the phone if GPS can be fixed.

    In the case where it cannot be resolved, it could offer to replace the iPhone 4s, if you are willing to pay the price for the refurbished phone.

    Out of warranty repair service

    If your repair is not covered by Apple limited one-year AppleCare warranty + or AppleCare Protection Plan, your iPhone may be eligible for out-of-warranty service. For example, the liquid damage is not covered by the warranty, but may be eligible for out-of-warranty service. Some damage is not eligible, for example, if your device has been broken into several pieces. See the terms of repair of Apple and Conditions for more details.
    Read the terms of Apple repair

    Model Out-of-warranty service fee Battery service *
    iPhone 6 s more, iPhone 6 Plus $329

    $79
    * available only if battery
    Apple diagnostic test failure

    iPhone iPhone 6s 6 $299
    iPhone 5, iPhone 5, iPhone 5 $269
    iPhone 4S $199
    iPhone 4, iPhone 3GS, iPhone 3G $149

    In addition, a $6.95 shipping charges if necessary. Fees are in US Dollars and exclude tax. The price is for the service through Apple. The final service charge we charge will be determined during the tests and may be less than the costs of service above. Pricing and terms vary for the service by an Apple authorized service provider.

    copied from: answer Service Center - iPhone


  • Cannot find the location of the gps on the device

    in my application, I'm trying to find the location of the user.my code owrks in Simulator for the curve8300 and the 9000 "BOLD"

    but he does not get the cordinates on the device even though I update the gps manually using the options--> options--> gps.

    What to do

     package com.MyChamberApp;
    
        import javax.microedition.location.Criteria;
        import javax.microedition.location.Location;
        import javax.microedition.location.LocationListener;
        import javax.microedition.location.LocationProvider;
    
        public class GPS_Location {
         static double longi;
         static double lati;
    
         public GPS_Location() {
    
         }
    
         public void location()
         {
          new LocationTracker();
         }
    
         class LocationTracker
         {
          private LocationProvider provider;
          Criteria cr;
    
          public LocationTracker()
          {
           resetGPS();
          }
    
          public void resetGPS() {
    
          try {
          cr = new Criteria();
          cr.setPreferredPowerConsumption(Criteria.POWER_USAGE_HIGH);
          cr.setPreferredResponseTime(120000);
                    cr.setCostAllowed(true);
          provider = LocationProvider.getInstance(cr);
          provider.getLocation(120);
          if (provider != null)
           {
            provider.setLocationListener(new MyLocationListener(), 1,1,1);
           }
          } catch (Exception e) {}
    
          }
    
          public void run(){}
    
         private class MyLocationListener implements LocationListener
             {
           public void providerStateChanged(LocationProvider provider,int newState)
           {
            if (newState == LocationProvider.TEMPORARILY_UNAVAILABLE)
            {
              provider.reset();
              resetGPS();
            }
           if (newState == LocationProvider.OUT_OF_SERVICE)
           {
            provider.reset();
            resetGPS();
           }
         }
    
         public void locationUpdated(LocationProvider provider,Location location)
          {
           if (location != null && location.isValid()) {
            try {
          lati = location.getQualifiedCoordinates().getLatitude();
          longi = location.getQualifiedCoordinates().getLongitude();
             } catch (Exception e) {}
         }
          }
        }
       }
     }
    

    Although the code seems fine for me, check with this code...

    Criteria criteria = new Criteria();
    
    criteria.setHorizontalAccuracy(50);
                criteria.setVerticalAccuracy(50);
                criteria.setCostAllowed(true);
                criteria.setPreferredPowerConsumption(Criteria.POWER_USAGE_HIGH);
                _locationProvider = LocationProvider.getInstance(criteria);
                  Location location =_locationProvider.getLocation(-1);
                _longitude = location.getQualifiedCoordinates().getLongitude();
                _latitude = location.getQualifiedCoordinates().getLatitude();
                 _altitude = location.getQualifiedCoordinates().getAltitude();
                 _speed = location.getSpeed();
                if(_locationProvider!=null)
                 {
                  _locationProvider.setLocationListener(new LocationListenerImpl(), _interval, 1, 1);
    
                }
    
  • Map screen: assign the same GPS location to a 'rare' image group

    Let's a have a buch of photos that were taken in the same place at different times. The images are scattered throughout the fimstrip and might even belong to different collections in the same catalog (or even different catalogs?). What is the best way to assign the same GPS coordinates to all these photos using the map screen?

    Of course, the direct way to do is to carefully select all of these photos in the Filmstrip, and then click the desired location on the map. It is problematic for reasons more than one. First of all, it is difficult to scroll the whole band and choose the photos one by one. Second, if I acccidentally miss one or two photos, I have to start all over again.

    The best way would be a sort of copy / paste appproach: copy the desired location in the Clipboard (another image or directly from the map) and then paste it on the desired images one by one or, better, on groups of images. A feature that, at first seems promising in this respect is the field of text input on the right that contains the GPS coordinates in the form of text. It is editable, which means that I can copy the coordinates (as text) of an image and paste it in the same field from another image. However, this unfortunately does not guarantee that images will end up with identical locations: the image that received the new coordinates could (and will be) end up with a slightly different location in terms of the image of the "donor". This means that the coordinates are stored internally with a precision greater than their representation in the text entry field.

    So, what are the other options?

    In the grid, select the "donor" photo, and then ctrl-click to select the photos of 'recipient '. Then synchronize the metadata, including the GPS location and any other fields that you want to synchronize. It's the equivalent of copy and multiple - Lightroom paste.

    This works only in a single catalog. It will not work in several catalogs (which of course is one of the many reasons why many people use a single catalog for all of their photos)

  • Locator GPS not finding the right place

    Atrix HD/MB886

    4.1.1 Android

    I have a few days ago, I noticed that my Groupon app showed me on the beach in Santa Cruz, CA. It would be nice, but my phone and I were actually North of Dallas, TX. Yesterday, it happened again, this time a rental program showed me still in CA. I called AT & T and they reset 'something' and everything was good until late at night. I was in CA. As of today, Google displays NOW that I'm in Santa Cruz, like life 360 (a follow-up program), as well as IMDB and 4Square. Anyone with some localization issues and how to fix this? I wasn't out of my country in a week or two, is not a memory problem.

    So far, I have disabled my location options, stop and reverse without change.

    I don't have the developers the options enabled, but I could see that the location allows to simulate is not checked.

    I just finish the phone off, remove the card sim, expectation, reinsert and power by your suggestion...

    Looks like that may have fixed! I'm a little skeptical because it worked for a short time yesterday, after AT & T reset something too. I'll post again if it brings back me to another location.

    Thanks again for your help and your quick response!

    Monica

  • Where is the calendar Gets the location of the House?

    When I ask the calendar to calculate the travel times it suggests a calculated from the House at the location in the calendar entry. It is said this is home', but when I add something to a close location (5 minutes), he said 14 hours, 25 minutes. I can't understand where he thinks is "Home". I looked in my address book and my entry has a home address that is correct (even if it is a mailbox, but the city is correct)...

    Where he finds the House?

    He probably uses "location services" to determine your current location based on your IP address and Internet routing hops.  Because most computers do not have a real GPS radio (like iPhones), they use location services to best estimate based information available based on your Internet connection.  The problem is that location services based on Internet IPs are easily deceived by how your ISP will route your traffic to the Internet, or things like the use of VPN, TOR, or anonymity.  Depends on the method used for the exact location is.  In your case, it is to be tricked and guess wrong.

    I just found this site that can give you a confirmation of this: http://mylocation.org/

  • Where are the location of metadata stored in pictures taken with an iOS device?

    I just follow me back from a trip with a lot of pictures taken with a couple of the iPhone as a digital camera.  Pictures taken with the iOS for most devices have locations associated with them, as evidenced by the dialog box 'Get Info' in Photos for Mac. They show well on a card and are correctly associated with keywords of the location (for example, "Sierra National Forest, northeast of Fresno County, United States of America"). But I can't know where the coordinates are stored. There is nowhere to search Photos for Mac that will give me the real coordinates. Also open images in preview does not display a GPS tab in the 'Détails' box how will be my camera equipped with GPS. And finally the search all metadata in Photoshop or Adobe Bridge also will not show all the details or any other type of geographic information.  I just checked my old version of iPhoto (9.6.1) and she won't show also all location information.

    Photos for Mac will display basic information, but I can't find where this happens. Any ideas?

    If you don't see any GPS information in the Inspector of Preview window, you are probably stripping while dragging or by exporting to office. Try dragging the image from Photos while pressing the Option key.

  • Paste the location of a photo to others in the Photos app?

    How can I paste the location of a photo to other photos (this was easy in iPhoto)?

    I'll often take a picture with my iPhone to get the precise location, and then paste this place to all the photos I took with my digital SLR.

    You can type the latitude, followed by the longitude in the location field of the Info for a photo Panel in Photos. Only, pictures don't show the location as latitude and longitude.

    You can see the latitude and longitude of a photo, if you export pictures then select in Finder and enter ⌘I for ' file > read the information.  The infopanel in the Finder will show the latitude and longitude.  Or use this script to copy the latitude and longitude in the jury of the dough: Script: extract numeric values using an Apple Script GPS

    Photos only, requires the coordinates to write with a decimal comma, not a comma, you may need to change the values returned, if your system preferences are set to write decimal numbers with a comma.

    And delete the part of the altitude of returned values.

  • The location based reminders are available on iPad wifi mini4?

    Hello - I can easily set reminders of the location based on my iPhone of course, but they do not appear on my new iPad Mini4 wifi. This feature is available on this model?

    Thank you-

    iPad Wi - fi does not have a GPS chip.

  • How do you add the location of many photos at once?

    How can I add the location (even) of many photos at the same time?

    For example, a visit to an amusement park where you took 100 pictures.

    My camera does not have a GPS feature, so how can I add this location even

    to all the photos without having to individually?

    Using the old iPhoto it wasn't hard, but I can't do it in Photo/El Capitan.

    Thanks for your help!

    Select all photos (Command is the keyboard shortcut), then click on the button top right of the photo window and click on assign a location, and then type the location in

  • In Photos, I changed the date, title and information on the location of the images of a slide digitizing company.  I want to preserve the custom metadata and the original resolution of 2500 dpi in a file backup, but when I export it loses my metadata chan

    Using version 1.3 of Photos, I edited the metadata about the images, I received a business of digitization of slides to insert the first day of the slide, the location, a title and a keyword.  I want to archive these images with the original resolution of 2500 dpi, but when I export original unmodified, it does not preserve information.  When I export by choosing export as XMP IPTC, I can't read the XMP file to see if there are my revisions.

    When I export using the 'Export # photo (s)' choice, I can use the previews/tools/Inspector/iptc and see my changes.  But this photo has only 72 dpi.

    Is there a way to preserve this modification of metadata information in the original not modified?  Alternatively, this file has XMP I exported the info?  If so, how can I read it?  And that would mean I need to export both the original unmodified and the XMP file to my files from archive?

    Don't know what you want - well there is a CIO field in the EXIF fields it is meaningless as DPI is not a setting but the result of a math problem third grade - points by (divided by) inches until you add inches per impression you have no IPR - and when you add inches the DPI for printing are determined by calculating not by any setting

    For more information, see http://www.rideau-info.com/photos/mythdpi.html

    A 1200 x 1800 pixels picture printed as a 4'x 6' printing is 300 DPI bit matter what setting the EXIF says

    LN

  • Can I make smart albums based on the location?

    Can I make smart albums based on the location of the GPS?

    For example, in the street, city, etc.?

    Thank you

    [City] - includes the menuFichier ==> new smart album - text or text [Street] etc.

    LN

  • Degree of accuracy is to find the locations of friends?  If the location of a person is updated, the situation might be wrong or delay?

    Degree of accuracy is to find the locations of friends?  If the premises of a person is updated on my phone, could be wrong or delay of an hour or two?

    It is as accurate as the location information that becomes their phone. And which can vary wildly. GPS signals are subject to an intervention by buildings, trees, weather. The phone can get information about the location of a WiFi network that is inaccurate. Find My Friends is certainly not specific enough to be invoked in situations of life and death. Nor should it be used as "evidence" that children or spouses are lying to you.

  • iPhone 5 s showing the location bad find my iPhone

    When I'm in my school after school, my phone watch I am across the street in the apartments across the school.  I had never moved from my school, and I have no idea where these apartments are still but it locates me in these apartments when me and my phone is in my school.  This happened twice with the same exact location, and as I said I've never set foot in these apartments or in this general vicinity in my life.  As an additional inconvenience, it look suspicious to my family when they check my site.  It appears through the find my iPhone.  My phone is now two years old, and I didn't modify parameters based on location I know.  If this could have something to do with the new software or accidentally turn me on a certain framework?

    What can happen is that your iPhone can not use GPS is to find your actual location when you are inside the building (GPS must have line of sight to communicate with satellites in the sky).  So if you're indoors all day, you iPhone must instead rely on IP geo location-based network, you're on from the cell towers or WiFi network.  This type of situation is much less precise that real GPS in your phone and your will be often average power off.  There is nothing you can do about it.

    You can do a test to see this in action by standing outside the school, opening Maps app and looking to see it is exact.  Then, close the cards, go inside the school, wait a minute or two, and then again open the cards and see where he thinks that you are (probably far away).

  • Why some of my photos have the location and some do not?

    I have an iMac with OS X Yosemite and Photo V1 (209.52.0)

    At the same time when I saw my photos on my iMac they included the location of the photo, such as the city.  Recently, my wife and I went to Europe and I took about 500 pictures with my iPhone.  When we returned, I downloaded them on mu iMac and when I find them they do not understand the location where I took pictures.

    Any ideas?

    GPS require a line of sight with the satellite as a disks sat does

    If you do not find that it will check the location of the cellular network or wifi router is connected to, if it is not connected to any

    or if the network or router does not provide a position then it is going to be any position on the photo

Maybe you are looking for

  • 5s iPhone battery

    I got my iphone 5S for about a year, I have never had a problem with the battery - full charge used to last me 12 hours, even without the low-power mode. Last week, that my battery was seriously spoil, even whenever my phone is locked my % battery wi

  • How can I change the search to an address bar bar?

    Not sure yet of the terminlogy here, but it's my problem better that I can describe it: I want the ability to directly access a site whose URL I type in the navigation bar. but, as it is right now, what I type must first go through a search. I am rel

  • HP laserjet p1102w: memory of toner p1102w

    No one knows how many cartridges the printer don't save in his memory or where I can find? Ive been through 3 until now and im save those used to fill the but I don't know if they will still be in the memory of printers or if I need to go through sev

  • Windows Installer + VSS + Windows problems in Windows 7 SP1 Activation

    I used this Windows 7 machine for 5 years now and has recently encountered several problems, which probably are closely linked: 1. Windows installation problemCan't update programs, although new install if they do need Windows Installer to do. Most b

  • iDRAC: cannot use vFlash as first boot device every time

    We want to use peripheral first as permanent vFlash of startup. Is this possible? Now I can't delete the 'boot once' for vFlash. All our SAS drives are configured within VSANs. We just want to use a small flash of 8G for ESXi OS disk.