473,399 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Search for surrounding suburbs query?

3
Hello,

Being new to ASP .net and visual studio express 2008 I am not sure how to create a webform that allows the user to select a suburb from a drop down list to search an Access 2007 database of suburbs. I would like to include in the result suburbs that are with a certain radius of the select suburb.

I have the table of suburbs (including latitude and longitudes), a form designed with appropriate dropdown list and a gridview.

the form works fine for an individual suburb, or if the user select --All suburbs-- from the list.

Now to my question...Sorry...

Can some point mein the right direction on how to create a surrounding suburbs search?

I hope this makes sense.

Thanks
Apr 3 '09 #1
3 2297
I am guessing you pick one suburb as the starting point and then specify a radius. You would then construct a containment polygon (just that circle in your example). If you pick 30 degrees for each point on the circumference, then you will get a 12 sided polygon or 13 points (each a lat/long) for a closed polygon. Any good high school trig book will have the formulas to calculate the point pairs. You just need to come up with a function to determine if any point from the surburb set of lat/longs lies within your containment polygon (ie: the sets intersect). This kind of assumes that the suburb's point collections are also organized as closed polygons.

Fortunately for me, I used functions in Esri's MapObjects to do just that
;-)

To keep things really simple, you could just use a great circle bearing function to see if the "center" of the suburb is within "X" nautical miles of the origin of your circle. If that is good enough, email me and I will send you a GCB function written in VB-6

HTH
Apr 3 '09 #2
ozboss
3
thanks for reply but I have managed to sort it out.


Here is the code:
Expand|Select|Wrap|Line Numbers
  1.             Dim radius As Double
  2.             radius = 5
  3.             radius = (radius * 0.621371192) ^ 2
  4.             Dim long2 As Double
  5.             Dim lat2 As Double
  6.  
  7.             If tb_suburb.Text <> "-- All Suburbs --" Then
  8.  
  9.  
  10.  
  11.                 Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & vbCr & vbLf & " Data Source=j:\ymca_good\rluwebsite\App_Data\RLU_Standalone.mdb;" & vbCr & vbLf & " User ID=Admin;Password="
  12.                 Dim sql As String = "SELECT * FROM subpcstate " & vbCr & vbLf & " WHERE suburb = '" & tb_suburb.Text & "'"
  13.                 Dim conn As New OleDbConnection(connectionString)
  14.                 Dim cmd As New OleDbCommand(sql, conn)
  15.  
  16.                 ' Open the connection, and execute the SQL statement. 
  17.                 cmd.Connection.Open()
  18.                 Dim reader As OleDbDataReader = cmd.ExecuteReader()
  19.                 If reader.Read() Then
  20.                     long2 = (reader.GetDouble(4))
  21.                     lat2 = (reader.GetDouble(5))
  22.                End If
  23.  
  24.                 ' Close the reader and the connection 
  25.                 reader.Close()
  26.                 cmd.Connection.Close()
  27.                 DS_search.SelectCommand = "SELECT GroupName, OrgName, Region, Suburb, keywords, Disability_keywords, RecordID, Address, Address2, Postcode, activities.activity,longitude,latitude   FROM full_activities where (69.1*([longitude]-" & long2 & ") * cos(" & lat2 & "/57.3))^2 + (69.1*([latitude]-" & lat2 & "))^2 <" & radius & " and (((GroupName LIKE '%' + @groupname + '%') or (keywords LIKE '%' + @keywords + '%')) and (orgname like '%' + @orgname + '%'))order by suburb,groupname"
  28.             Else
  29.                 DS_search.SelectCommand = "SELECT GroupName, OrgName, Region, Suburb, keywords, Disability_keywords, RecordID, Address, Address2, Postcode, activities.activity  FROM full_activities where ((GroupName LIKE '%' + @groupname + '%') or (keywords LIKE '%' + @keywords + '%')) and (orgname like '%' + @orgname + '%') and (suburb like '%' + @suburb + '%') and (region like '%' + @region + '%') and (disability_keywords like '%' + @disability_keywords + '%') order by suburb,groupname"
  30.             End If
Apr 3 '09 #3
ozboss
3
Sorry. I will make sure I dont forget in the future. Thanks for correcting.
Apr 5 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: nortelsale | last post by:
i have a site that allow people to post for sale, for rent info, I want to have advanced search function that can search all the posting (in my site) by zip code, and by certain miles say 10, 20...
4
by: Ken Fine | last post by:
I'm looking to find or create an ASP script that will take a string, examine it for a search term, and if it finds the search term in the string, return the highlighted search term along with the...
5
by: Martien van Wanrooij | last post by:
I have been using phpdig in some websites but now I stored a lot of larger texts into a mysql database. In the phpdig search engine, when you entered a search word, the page where the search word...
6
by: Pacific Fox | last post by:
Hello all, Does anyone know the SQL statement for calculating surrounding suburbs, or can point me in the right direction? I have a database of Australian postal codes and their centroids in...
0
by: | last post by:
I have a question about spawning and displaying subordinate list controls within a list control. I'm also interested in feedback about the design of my search application. Lots of code is at the...
1
by: cglewis03 | last post by:
Hello, I am trying to build a search form with several different options to choose from. Currently it is set up to open within the same window if a single option is selected and open within a...
12
by: David | last post by:
Hi, I am trying to achieve the following: 1/ To have a standard form in an asp web page which has various check boxes and radio buttons. As a user selects a form item it updates a text box,...
2
by: Petonii | last post by:
Hello fellow programmers, I am new to this site and was looking around for some good advice or if i am lucky some help. I am starting off a basic local business search project just for some...
13
by: Robertf987 | last post by:
Hi, Yet another thing I need help with I'm affraid. I'll first explain what I want, then I'll try to explain what I have. I'm using Microsoft Access 2000. What I want is to be able to do a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.