Working with latitude/longitude values in Java/MySQL -


i have database table containing location latitude , longitude. given following values latitude, longitude, minx, miny, maxx, maxy. need return records database table lat, long fall within range.

you'll want use preparedstatement anytime need make complex sql query such this. here's pseduocode give idea of you'll doing:

string query = "select * `dbtablename` latitude >= ? , latitude <= ? ,      longitude >= ? , longitude <= ?`";  preparedstatement ps = connection.preparestatement(query); ps.setlong(1, minx); ps.setlong(2, maxx); ps.setlong(3, miny); ps.setlong(4, maxy);  resultset rs = ps.executequery(); 

the list of records satisfying query accessible via resultset


Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -