Question : Radius Search..  with x,y

I have all postcodes in my access DB, I want to measure distances by giving the radius of some value and find all other postcodes in side that radius.in my access DB, i have keyCode,PostCode,xCoord,yCoord  only these fields. i dont know the Latitude Longitude values, i know only the x,y Coordinates.i am using vb to calculte this.

any one have solution for this. its very urgent.

Answer : Radius Search..  with x,y

Ok - so we're back at the original question.

For the solution I suggested, you would put all the values as you have them in your spreadsheet. You would put the Latitude values in a column "Latitude" and the Longitude values in a column "Longitude".

If this was MS Access (my solution was in Access), you would create the following queries (reposted and cleaned up):


SELECT tPostcodes.Areacode, tPostcodes.Latitude*3.1415926/180 AS LatRad, tPostcodes.Longitude*3.1415926/180 AS LonRad, [QueryLatitude]*3.1415926/180 AS QLatRad, [QueryLongitude]*3.1415926/180 AS QLonRad FROM tPostcodes;

SELECT qDistance1.Areacode, Sin([LatRad])*Sin([QLatRad])+Cos([LatRad])*Cos([QLatRad])*Cos([LonRad]-[QLonRad]) AS cosd
FROM qDistance1;

SELECT qDistance2.Areacode, Abs(60*180/3.141526*2*Atn(Sqr((1-[cosd])/(1+[cosd])))) AS DistKm
FROM qDistance2
ORDER BY Abs(60*180/3.141526*2*Atn(Sqr((1-[cosd])/(1+[cosd]))));

SELECT * FROM qDistance3 WHERE DistKm < [Distance in km];


where the location of the post office in the center of the radius has the coordinates [QueryLatitude] and [QueryLongitude] and the maximum distance is [Distance in km].

The result of the query will be all post offices in a circle around [QueryLatitude] and [QueryLongitude] which are less than [Distance in km] away. ordered by distance, i.e. nearest post offices come first.

What I'd suggest then is to enter the data and the queries into MS Access first and then use the migration wizard to transfer them to the SQL DB. If you can't do this, I can give it a try.
Random Solutions  
 
programming4us programming4us