Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6761979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:15:30+00:00 2026-05-26T14:15:30+00:00

I have a Java application and I would like to find out the location

  • 0

I have a Java application and I would like to find out the location of a visitor. The API would give me a the zip code of visitor and then based on that zip code, I will find fire a query and get users in my application within 25/50 mile radius.
Alternatively visitor can type in the zip code of their interest and application should return users withing x mile of radius.
For the users who are registered in the system, we have only their zip code.
I have looked around some options but not found the exact solution. I do not want to download the database of zip code and maintain them.
I do not think Google API support this kind of stuff.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T14:15:30+00:00Added an answer on May 26, 2026 at 2:15 pm

    I could not find any service which offers API . After much research i found that you will have to download zip codes along with their latitude and longitude positions into a table. Then
    calculate co ordinates within the radius you want to search.
    This is the website which helped me a lot.
    http://www.dougv.com/2009/03/27/getting-all-zip-codes-in-a-given-radius-from-a-known-point-zip-code-via-php-and-mysql/

    Here is the calculation in java if you really if you do not want to work with php

    //this you will get by querying the database against the zip code
    Double latitude = Double.parseDouble(zipCode.getLatitude());
    Double longitude = Double.parseDouble(zipCode.getLongitude());

        Double latN =Math.asin(
                Math.sin(Math.toRadians(latitude)) * Math.cos(distance/radius) + 
                Math.cos(Math.toRadians(latitude)) * Math.sin(distance/radius) * Math.cos(Math.toRadians(0)));
    
    
        Double latS =Math.asin(
                Math.sin(Math.toRadians(latitude)) * Math.cos(distance/radius) + 
                Math.cos(Math.toRadians(latitude)) * Math.sin(distance/radius) * Math.cos(Math.toRadians(180)));
    
    
        Double longE = Math.toRadians(longitude) + 
                        Math.atan2(
                                Math.sin(Math.toRadians(90)) * Math.sin(distance/radius)* Math.cos(Math.toRadians(latitude)) 
                , Math.cos(Math.toRadians(distance/radius)) - Math.sin(Math.toRadians(latitude))* Math.sin(Math.toRadians(latN)) );
    
        Double longW = Math.toRadians(longitude) + 
        Math.atan2(
                        Math.sin(Math.toRadians(270)) * Math.sin(distance/radius)* Math.cos(Math.toRadians(latitude)) 
                    , Math.cos(Math.toRadians(distance/radius)) - Math.sin(Math.toRadians(latitude))* Math.sin(Math.toRadians(latN)) );
    
        System.out.println("Latutude N "+Math.toDegrees(latN) +" Latitide S "+Math.toDegrees(latS) +">>> Longitude E "+Math.toDegrees(longE) +" Longitude W "+Math.toDegrees(longW));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Java application and I would like to make it extensible. To
I am developing a Java desktop application and would like to have an external
I have a few JAVA application that I monitor using JMX. I would like
I have built a Java application that has some dependencies (~10). I would like
I have an application where I would like to have mixed Java and Scala
I would like to create extend a Java Swing application to have a look
I have made a small application in Java and I would like to make
I have an application hosted in Java on AppEngine and I would like to
I have a web-application written in java. I would like to run integration tests
I would like to find out what is the purpose of the JVM (Java

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.