Search by zipcode

Anyone do a 'search by zip code within a certain distance'
with a variable
of distance (i.e. 25 miles)?
I downloaded a zip code database with a ton of zip codes in
it. I can get
the longitude and latitude of each zip code when querying it
with the
entered zip code.
How do I then query the database to search within 25 miles of
the longitude
and latitude? I would like the function to query the database
and grab a
bunch of zip codes within the distance and then query that
against the
possible zip codes in the rescues database to match only
those within the 25
miles.
Any tutorials? Anyone have an example finished (code)? Anyone
know the
correct way to do this? I am only guessing on how it is
actually done.
Thanks!
Wally Kolcz
MyNextPet.org
Founder / Developer
586.871.4126

Ok, I am retarded. Each I find asks for 2 longitudes and 2
latitudes. What
am I missing. I can grab the longtitude and latitude from the
user's zip
code from the database of zipcodes I have. I can ask for the
max distance
(25 miles, 50 miles, etc.) But then I need to plug those
values into a
formula to generate a range of zipcodes that fall within,
right?
I found this while searching for the formula:
What is my second long and lat when I am supplying the first
long and lat
and distance from the user's information.
<!---UDF distance Formula||--->
<CFSCRIPT>
//calculate the Deltas
function distance(lat1,lat2,lon1,lon2)
{ km=6367;
deltaLon=twoRadians(lon1)-twoRadians(lon2);
deltaLat=twoRadians(lat1)-twoRadians(lat2);
//intermediate values
intMedVal = sin2(deltaLat/2) + cos(twoRadians(lat1)) *
cos(twoRadians(lat2)) * sin2(deltaLon/2);
//the great circle distance in radians gcd = 2 *
arcSin(getMin(1,Sqr(intMedVal)));
//multiply the the radians by the radius to get the distance
in specified
units d = km * gcd;
//this only applies to us (ANDRONICS.CO.UK)
//it relevant to the vendor that is displaying the map data
//the map is coming back in rectangular format they use the
length as the
zoom distance
//we multiply it by 2 two get an equal zoom distance from top
to bottom
d = round(d * 2); }
//Convert to Radians
function twoRadians(currDegree){
(currDegree * (Pi()/180));
function sin2(currVal){
(1 - cos(2*currVal))/2;
} function arcSin(x){
atn(x/Sqr(-x * x + 1));
} function getMin(y,z)
{ if(y lte z){ getMin=y;
}else{
getMin=z;
</CFSCRIPT>
<CFSET
ATTRIBUTES.D=distance(maxLatitude,minLatitude,maxLongitude,minLongitude)>
I appreciate the help and the patients. This one really
confuses me... :)

Similar Messages

  • Sales Order/Quotation, Delivery, Returns.  Need a way to search by zipcode

    Using 2007a SP0 PL49.
    In Sales Quotation, Sales Order, Delivery and Return submenus.
    We can have 100s of shipto on our major accounts.
    Users typically search by postal codes, we haven't migrated to SBO yet, this is a road block for it.
    So far, I have a query to a UDF LookupPostalCode that feeds into the Shipto, it works under the content tab's rows but in logistics tab where it's really needed, I can't put my UDF, can't seem to find a spot or a field I can replace.
    I've been using this query and it works in the rows for content...
    SELECT Address FROM CRD1
    Where AdresType = 'S'
    AND CARDCODE = $[$4.CardCode]
    AND ZipCode = $[$38.U_LookupPostalCode.STRING]
    Any suggestions to make this happen in logistics without sdk?
    Note: the postal codes are unique per site in this case.
    Thanks,
    Marc

    See the ZoomSearch page on my site.
    Sorry to give such a short answer but I think it is the right one.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • Apple map does not resolve 84091 zipcode?

    Open Maps
    Search for Zipcode 84091
    Expected should show Sandy,UT as the top search result.
    Actual Does not show any city in USA!

    Click the "i" in the bottom right and select Report a Problem. I've actually received responses back when things have been fixed.

  • Cannot close an XML file used for parsing

    Hi All,
    I appears to have difficulty closing (possibly flushing it first) an XML file that was subsequently being parsed without success. The error generated is:
    org.jdom.input.JDOMParseException: Error on line 23: The element type "form" must be terminated by the matching end-tag "</form>".
    Below is the code snippets of readData() to retrieve (HTML) data from a website, save it to a file, then convert to XML format before returning the new filename:
    public String readData() {
        try {
              URL url  = new URL("http://www.abc.com");
              URLConnection connection = url.openConnection();      
              InputStream isInHtml = url.openStream();   // throws an IOException    
              disInHtml = new DataInputStream(new BufferedInputStream(isInHtml));         
              System.out.flush();
              FileOutputStream fosOutHtml = null;
              fosOutHtml = new FileOutputStream("C:\\Temp\\ABC.html");
              int oneChar, count=0;
              while ((oneChar=disInHtml.read()) != -1)
                  fosOutHtml.write(oneChar);
              isInHtml.close();
              disInHtml.close();
              fosOutHtml.flush();    // optional
              fosOutHtml.close();
        try {
              File fileInHtml = new File("C:\\Temp\\ABC.html");
              FileReader frInHtml = new FileReader(fileInHtml);
              BufferedReader brInHtml = new BufferedReader(frInHtml);
              String string = "";
              while (brInHtml.ready())
                  string += brInHtml.readLine() + "\n";
              fwOutXml  = new FileWriter("C:\\Temp\\ABC.xml");
              pwOutXml  = new PrintWriter(fwOutXml);
              light_html2xml html2xml = new light_html2xml();
              pwOutXml.print(html2xml.Html2Xml(string));
              system.out.flush()     // optional
              fwOutXml.flush();      // optional
              fwOutXml.close();
              pwOutXml.flush();      // optional
              pwOutXml.close();
              return fileInHtml.getAbsolutePath();
    // parseData reads the XML file using the name returned by readData()
    public void parseData(String XMLFilename)
        try
            FileReader frInXml = new FileReader(FileName);
            BufferedReader brInXml = new BufferedReader(frInXml);
            SAXBuilder saxBuilder = new SAXBuilder("org.apache.xerces.parsers.SAXParser"); // JDOMParseException generated.
    }These codes would worked when they were in a single method but I have since placed some structure around them using a number methods.
    This issue has risen in th past where I have been able to close the XML file prior to reading them again. However, I don't have a solution for it this time round.
    I am running JDK 1.6.0_10, Netbeans 6.1, JDOM 1.1 on Windows XP platform.
    Any assistance would be appreciated.
    Many thanks,
    Jack

    Hi Alain,
    I have added the additional I/O statements in the finally clause as follows but the problem still persisted:
    readData()
    // reading data (html) from the webpage and save it in html format.
    try {
    catch { …. }
    finally {
           System.out.flush();
           isInHtml.close();
           disInHtml.close();
           fosOutHtml.flush();
           fosOutHtml.getFD().sync();
           fosOutHtml.close();
    // convert the html webpage format to xml format
    try {
    catch { …. }
    finally {
           System.out.flush();
           fwOutXml.flush();
           fwOutXml.close();
           pwOutXml.flush();
           pwOutXml.close();
    Below is a short listing of the new XML file:
      <?xml version="1.0" encoding="iso-8859-1" ?>
    - <html>
    - <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      <meta name="keywords" content="California, cities, towns, villages, list, zipcodes, postal codes, united states, ca" />
      <meta name="description" content="Cities, towns and suburbs in California, United States (CA) starting with A" />
      <title>Cities and Towns in California starting with A – ABC Company</title>
      <link rel="stylesheet" href="http://www.abc.com/style.css" type="text/css" media="screen" />
      </head>
    - <body>
      <a name="top" />
    - <div id="container">
    - <div id="header">
      <div id="postmark" />
    - <a href="http://www.abc.com/" class="imglink">
      <img id="logoimg" src="http://www.abc.com/images/zipcodes.gif" width="192" height="33" alt="Zipcodes America Logo" />
      </a>
      <hr />
      </div>
    - <div id="nav">
    - <ul>
    - <li>
      <a href="http://www.abc.com/" title="Home Page">Home</a>
      </li>
    - <li>
      <strong>Search</strong>
      (zipcode or suburb)
    - <div class="hide">
      <form method="post" action="http://www.abc.com/search" />        // line 23
      </div>
      <input type="text" name="q" class="searchbox" alt="Search query" />
      <br />
      <input type="submit" value="find!" class="searchbutton" alt="Perform search" />
      <div class="hide" />
      </li>
    …What I find it interesting is that it is possible to parse the above XML file with the same parseData() from another class without any problem. As a result, I have come to the following conclusion so far:
    ( i ) There is some file locking that is prevent saxBuilder from parsing the XML file at the time.
    ( ii ) The light_html2xml does not appears to have correctly converted over the orginal Html to Xml but some how it has been picked up by the parser in the same class, but not by the same parser from another class.
    ( iii ) I would like to use another conversion tool such as Tagsoup in place of light_html2xml to determine where the cause of this issue is coming from. As a result, would you or anyone be able to assist me coming up with a few lines of conversion statements using Tagsoup since I am not familiar with using this tool?
    ( iv ) light_html2xml is good as it strip out all namespace, DTD, Entity Resolver, etc and only return what I need. JTidy does correct conversion but include namespace, DTD, Entity Resolver which makes parsing difficulty.
    Many thanks again,
    Jack

  • ZipCode validation based on locale

    Hello All.
    I'm currently developing an application and i kind of ran
    into some problems that i'm trying to find a possible solution.
    This app will be used for many users spread out into Europe, Asia
    and Americas and one requirement is to validate a given zipcode
    based on the user's locale.
    I've been trying to find examples on any possible web search
    engine that you could possible think of and no results so far.
    Please, if any examples/questions fell free to write me or
    reply to this topic, your help is greatly appreciated.
    Thanks
    Alvaro Costa
    Software Engineer
    [email protected]

    Here is a macro (sql function) we use for Canadian Postal
    Codes. Bear in mind that the data we receive does not have the
    normal space between the 3rd and 4th characters. The percentage
    sign represents the argument.
    returns Y or N to indicate whether postal code is valid CASE
    WHEN
    SUBSTR(%1,1,1)IN('A','B','C','E','G','H','J','K','L','M','N','P','R','S','T','V','X','Y')A ND
    SUBSTR(%1,2,1)IN('0','1','2','3','4','5','6','7','
    8','9')AND
    SUBSTR(%1,3,1)IN('A','B','C','E','G','H','J','K','L','M','N','P','R','S','T','V','W','X', 'Y','Z')AND
    SUBSTR(%1,4,1)IN('0','1','2','3
    ','4','5','6','7','8','9')AND
    SUBSTR(%1,5,1)IN('A','B','C','E','G','H','J','K','L','M','N','P','R','S','T','V','W','X', 'Y','Z')AND
    SUBSTR(%1,6,
    1)IN('0','1','2','3','4','5','6','7','8','9')THEN 'Y' ELSE
    'N' END

  • Searching contacts using iCloud contacts on windows 7

    Have installed icloud control panel on my windows 7 operation system.  Now syncing outlook calendar and contacts, but can no longer search my contacts by city, state or zipcode.  If possible please reply to [email protected]  Thanks.

    Sorry, I should have said there does NOT seem to be an option to select multiple files and download from iCloud using iTunes Match.

  • Why is my phone "Searching..." constantly?

    I purchased an iPhone 5 on pre-order day, and have had it now for a few weeks.  A few days ago, I noticed my service flicker from "Searching..." to "No Service" to "Verizon LTE".  I didn't think much of it, but in a few moments, it happened again.  And again.  And again.  Finally, my service went from 5 bars to 0, then "Searching...".  I left the phone alone for a while thinking there was maintenance being done on a tower, however, over the course of a few hours, I was still getting the "Searching..." message.  I've tried popping out the SIM card and re-seating it, I've tried resetting network settings, power cycling, hard rebooting (home and wake/sleep together until it resets)...  I have noticed however, that when I pop the SIM card out now, I don't get a "No SIM" message.  I just get a "Searching..." message.
    I managed to get service back after a few hours of wondering, and a restore from backup (which was a fight in itself).  However, my phone has once again fallen silent, even though it was working perfectly fine yesterday.
    Did I do something?  I've only dropped my phone once, and it was onto a carpeted surface from about knee high, so I highly doubt that was the cause.  Is it a SIM card problem?  I know it's not a service problem as my wife's phone (iPhone 5 on the same plan) is working flawlessly (and she's dropped hers a few times already).
    Did I just get a defective model?  This is extremely frustrating, and my work requires that I have a phone, so the faster this can be answered, the better!!

        I know that its frustrating to have issues with your phone when you need to contact a friend or family member. Not know if it will connect is very upsetting. I'm sorry the mentioned suggestions did not work. Lets try removing and reinserting the SIM card to help with your issues. Make sure the phone is powered off first. Here are some steps? Also, whats your zipcode? We can check the area to look for any reported problems. Are the issues occuring inside or outside? At home only or when you leave the area? Is the phone damaged? Lets start with these few simple questions and we can get this resolved together. Keep us posted.
    Kinquana_VZW
    Please follow us on twitter @VZWSupport

  • Search function with multiple keywords

    hi everybody,
    im a beginner apex developer, im trying to develope a search function on my page.
    i have created an item "where" where u can give the adress u r looking for.
    my problem is that the search works only when i insert one word into the item e.g. street or city.
    when i try to look for street and city at the same time it doesnt work.
    in my database i have columns for city, street, zipcode... etc
    and im using Application Express 3.1.2.00.02
    this is my search code
    select country, city,zipcode, street
    from mytable
    where
    +( lower(city) like '%' || lower(trim(:P1_WHERE)) || '%'+
    OR lower(zipcode) like '%' || lower(trim(:P1_WHERE)) || '%'
    OR lower(street) like '%' || lower(trim(:P1_WHERE)) ||  '%'
    OR lower(country) like '%' || lower(trim(:P1_WHERE)) || '%')
    i have tried to solve the problem by adding combination after OR:
    lower(concat(trim(city) like '%' ||  lower(replace(:P1_WHERE,' ','')) || '%'||,trim(zipcode) like '%' ||  lower(replace(:P1_WHERE,' ','')) || '%'||))
    but this is not working. and i will have too many combinations.
    any help is highly appreciated!
    Edited by: user12976392 on 14-Jun-2010 07:08

    Oracle don't provide any SPLIT() function, I don't know why.
    But you can use INSTR() and SUBSTR() functions instead.
    There are some split functions on the web, like this one for example (don't really split but get tokens) : http://glosoli.blogspot.com/2006/07/oracle-plsql-function-to-split-strings.html.
    Then you can loop to get all the tokens (here I used the ' ' separator) :
    DECLARE
          oneToken VARCHAR2(100) ;
          cpt INTEGER := 1;
    BEGIN
          LOOP
          oneToken := get_token(html_GetElement(P1_WHERE).value, cpt , ' ') ;
          EXIT WHEN oneToken IS NULL ;
          cpt := cpt + 1 ;
        END LOOP ;
    END ;Using this you can build your query as string, then open a cursor to run it, using :
    open my_cursor for my_string;I really don't know if it's the best way to do this, it's just an idea.

  • Formatted search logistic tab

    hello,
    I have a problem: I want to copy using formatted search, in  return document , in logistic tab, the supplier's address and not the warehouse address, this is my query but i'm  not able to find the trigger to Taking automatic query, how can i do it?
    SELECT T0.[Address], T0.[Street], T0.[ZipCode], T0.[City] FROM CRD1 T0 WHERE T0.[CardCode] = $[$4.0.0]

    You have to either use the CardCode or DocTotal for the refresh.
    In System Init > Document Settings > General Tab......Use Warehouse Address is what drives the warehouse address to be used in all AP documents.
    If you want to simply copy the Bill To address shown on the AP Return then you can use the FMS
    SELECT $[$6.0.0]
    If you want the address from the BP Addresses table then you should use the following Syntax in your SQL to let the Address in the structure on multiple lines
    SELECT T0.Address + Char(13) + T0.Street + Char(13) + T0.Block + Char(13) + T0.City + ',  '+ T0.ZipCode
    FROM [dbo].[CRD1] T0
    WHERE T0.CardCode = $[$4.0.0] AND T0.AdresType = 'B'
    The AdresType determines which Address you want to pick  'B' for Billto and 'S' for Shipto

  • Additional Search Criteria for I-Objects in IC Web Client

    Hi,
    I need to add addtional search criteria  like City, Region and Zipcode for I-Objects in the IC Web Client. Can anyone suggest me how to include these new fields?
    Thanks,
    Vijay

    Hi Igor,
    Thanks for your reply. Could you please let me know how did you proceed on this problem. Did u contact SAP for this? If so, what is the procedure to contact them? Please let me know so that I will be able to take up this issue with my client.
    Thanks,
    Vijay

  • Newbie question on searching..

    Lets say I have the following entries:
    dn: l=Boston,ou=12345,c=US,dc=mycompany,dc=com
    description: Test1
    dn: l=Seattle,ou=12345,c=US,dc=mycompany,dc=com
    description: Test2
    dn: l=San San,ou=12345,c=MX,dc=mycompany,dc=com
    description: Test3
    (ou=zipcode)
    How do I do a search to return all locality entries(& descriptions) for the Zipcode 12345. Can the locality entry somehow inherit the zipcode (ou) attribute/value so when I do a search on ou=12345, it will also give me all the localities?
    This is only an example, so assume that the structure can not be modifed.. I could do this search by running 2 search commands.. One to get me the dn's for (ou=12345) and use each dn for another search using it as the basedn for the locality search. Anyway to do this with just one search though?
    Hope this isn't too confusing.
    Thanks,
    Matt

    Mark,
    It seems you are asking to be able to recover all entries with, say, (ou=12345) in the dn. A search filter like the following should do the trick:
    "(ou:dn:=12345)". But as usual, be careful to ensure any attributes you need to search on are indexed.
    You ask about the locality entry inheriting the zipcode value....the COS functionality in iDS 5.x could provide a way to do this by automatically populating the locality attribute as a function of the subtree.
    Rob.

  • Longitude and Latitude to search by zip

    I found the formula that calculates distance with zip codes.
    Where do I get
    the 2nd long and lat for the formula? Do I add the distance
    (25 miles) to
    both long and lat to get the 2nd set of variables? Or do I
    use the base long
    and lat add and subtract to get the 2 sets?
    Has anyone done a search using zip codes to determine
    everything within a
    specific range (miles / kilometers)?
    And when I get the result of the formula, how does it apply
    to getting a
    range of zip codes? And how to I query using the result.
    Thanks
    Wally Kolcz
    MyNextPet.org
    Founder / Developer
    586.871.4126

    Took a lot of tweeting and work, but I got it to finally
    work, Thank you so
    much!
    I had to edit the cfc to work (the SQRT function was spelled
    out SQUARE and
    gave me fits) and I had to capture and convert a whole new
    set of zip codes,
    longitudes and latitudes and convert them into the radiuses.
    But all in all
    it finally worked. The database on the example is written for
    MS SQL and I
    am using MySQL. Each enough to do. All I had to do is take
    the text file,
    add headers to the data, save it as a CSV, take it using
    CFhttp and loop it
    into the MYSQL database while converting the longitude and
    latitude into
    'rlongitude' and 'rlatitude' which the CFC requires to make
    it work.
    Thanks again Ian. I still want to add you to my site with a
    linkback if you
    want it.
    If anyone wants the modified CFC, application.cfm, and a
    MYSQL script for
    the zipcodes of the US (and beyond). Let me know
    wkolcz (at) mynextpet (dot) org

  • HT203164 help! i am using itunes 10.6.1.7 and windows vista 64. itunes will no longer burn cds. i have searched online and tried all i saw that could possibly fix it and it is still not working.

    i have tried:
    reloading itunes
    unchecking 'write'
    removing lower filters in regedit
    ensuring i had the correct 'gear' info in the upper filters in regedit
    removing 'gear' from regedit, system32
    reloading updated version of 'gear'
    cleaning my registery
    deleting itunes
    cleaning registry again
    reloading itunes
    cleaning registry again
    i still cannot burn cd. t i can import and play cds in itunes and i can watch dvds. itunes will just not burn to blank cds, and i have tried sever new blank cds, each is not recognized.
    i do not know what else to do, i have searched the internet and whatever i saw doable i tried.
    when i check the cd drive in itunes i had gotten a 4220 error, cnet advised to download a free error fixer, however, this error fixer gave me and enduser message, so that didn't work.
    the diagnostic for the cd burner read that i had to put in a formatted disc with content so i did and there are the results of that were that it read the cd and that the 4220 errir code was encountered last time there was an attempt to burn.
    and 'could not open cd handler 32. there is a problem with the installation of the drive in windows or the drive contains a copyprotected cd.
    the above is not the case as it also popped up for me to import cd to itunes.
    i tried to copy and past the entire contents here but it would not allow me to paste.
    please help!

    I too have only recently encountered this problem. I have been able to burn disks before but it keeps making all these weird sounds. It might be a hardware problem but the fact that everything else that uses a disk works I doubt it.

  • Not able to view data in Aria People search Org Chart

    Hi,
    I have uploaded my data into aria_tmp_people, aria_people_a & aria_people_b.
    While doing the search from Aria poeple, the uploaded data is not displaying in org chart.
    Your help is highly appreciated.
    Thanks
    Aneesh

    Hi Aneesh,
    First be more clear about Aria Application. As Aria, is been related to an hrms part of an organization carrying the people infomation and it has some separate features too.
    But in your prespective i couldnt able to understand what do you want to do with that packeged application.
    Since you want to customize the aria application according to your organization needs means, First collect all your necessary organization information that is needed(like tables etc.). Then substitute those (i.e) your organization tables in the appropriate places in the form of query.
    Please dont use the same Aria people table, as the Oracle may framed according to their employee information. Nearly Aria application has 200 supporting objects. If you want to use the same objects means whether u r going to creating nearly 200 supporting objects..It is not worth at all.
    Please be more clear in your requirement that, what you are doing, and then raise the question. Be more prepared with your tables along with datas, and let give your reply once you were been prepared with your organization details table.
    As there are more peoples in the forums to help you other than me.
    Brgds,
    Mini
    Mark Answers Promptly

  • Can no longer enter data in the address bar {url Bar}, it correctly follows data from google search bar. It was a 1 month old installation so not a lot of complications

    I was not adding anything to Firefox. I Refused tool bars embedded in several application installs on this new computer. Was working fine. Then had a problem with Google search, restored default values and re-tooled Firefox. At this point all worked fine. Then my url, address bar changed color to the same color as the program shell, a grey brown as opposed to the white it was before. With the change in color it no longer allows me to change the data showing in the bar. I can not delete or add data. I used to add a url and navigate to the domain. Now I can not

    Greetings,
    TY for the reply, the information was enlightening to be sure. I never knew safe mode was an option with Firefox. I have so many tasks running that I didn't want to shut things down. What I did is turn off some of the last plug-ins I installed. That did not fix the problem at least in the first look. What happened next was very interesting none the less. I had a moment of mouse spastic wrist syndrome and accidentally moved a tab in such a way that it opened in a new window. The URL bar was white and editable. So I moved all my tabs to the new window and everything works as it should. I have restarted Firefox this morning and it came back with the bar editable and I am speechless to understand what I may have done to correct the problem if anything ??

Maybe you are looking for

  • How do I use AppleTV with Airpla with wirless speakers in multiple rooms

    I like to think this should be simple but I cannot find out how to do it reasonably.  I have a family room with a flat screen and have successfuly connected Apple TV to it.  I have successfully connected my various devices (iPad and iPhones) to the A

  • In windows vista control Panel won't open

    in windows vista control panel icloud is there but won't open. how do i fix this? also photo stream is not  working right.

  • Send Drawings via message determination

    Dear Friends We are using DMS (Document Management System) and I would like to know some things: u2022     I would like to see at item level an icon which shows if the material have attached documents. How can I do it? u2022     I would like to send

  • Creating entry in table OIGSVMQ

    Dear All, I am working as SD/IS-OIL consultant and new to working in this Shipment notification-reservation-shippment scheduling cycle (MM/IS-OIL) . I am facing this problem where the shippments which I am creating are having some missing information

  • Intermittent "Camera not Detected" with D90 and Windows 7

    I just installed and set up LIghtroom 4 on a Windows7 PC. We are having intermittent problems shooting tethered with a Nikon D90. We have successfully been able to tether the D90 to and capture images in Lightroom. But now we are frequently receiving