Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I want to do reverse geocoding from MySQL or PostGIS SQL.

I have shapefile up to town level of India. So I have a geometry boundary for each town.

What I want is to first find the nearest point from the current position and check that point is in which towns.

I want to get the result in this format: Towns, District, State, Country

I dont have knowledge of PostGIS SQL but I know MySQL. But if anyone can help me I will use the PostGIS SQL also.

So I want fastest way to do reverse geocoding.

Thank you.

share|improve this question
    
I'm having trouble understanding what you are wanting by saying : "What I want is to first find the nearest point from the current position and check that point is in which towns." Do you have a set of points which you wish to classify as belonging to a town, district, state and country? –  Jayden Nov 1 '12 at 3:10
add comment

1 Answer

So i assume that you have 4 levels of polygons , Country polygons have State polygon inside and State polygons have District polygon inside...

Also i assume that you have all those polygon in one table

SELECT * FROM india_polygons as i , point p WHERE ST_Contains(i.the_geom , p.the_geom) IS TRUE AND p.id = 42

Is one way of doing it

Offcourse fastest way is pre calculate Town, District, State, Country relation and then do only spatial search wher you find which town point is in.

works in postgis , maybe in mysql

share|improve this answer
1  
All this polygon is in different table. State,District,Town I want to retrieve the each name from that polygon which is in boundary. –  sandeep Nov 15 '12 at 19:13
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.