1

I am developing an application to display OSM data. In my scenario I need to display the data for one entire country. So my approach is that I will load curresponding countries osm data to postGreSQL and fetch it back on demand.

I am providing the zoom facility here (from 0 - 19) and for each zoom level I will query different data based on what need to be displayed at that zoom level and using a bounding box. I am new to this approach. As there exist experts here, I would like to know how feasilible would be this approach in terms of performance? (Ealrlier I try to use osm.pbf files and trying to read it dynamically and display; but it hit the performance badly.

My second question is: I tried to query all the lines within a given bounding box but it displays empty row as result. May I know what I am doing here now?

SELECT * FROM public.planet_osm_line where ST_INTERSECTS(way ,ST_MakeEnvelope(1.4411000, 41, 1.4411530, 45));

Neither the below query worked (I assume that I can give the lattitudes and longitudes here to define the bounding box here reference: Select bounding box using postgis)

SELECT * FROM public.planet_osm_line where ST_INTERSECTS(way ,ST_MakeEnvelope(-180, -180, 180, 180));

I tried the below query also to fetch some data in France area. But failed again

SELECT * FROM public.planet_osm_line where ST_INTERSECTS(ST_Transform(way,4326) ,ST_MakeEnvelope(-73.3968207647942, 49.296681801433,-73.823777534737, 49.5751193739016));

Please advise.

  • I got it solved. A small issue with the SRID value caused the trouble. The resultant query is as follows... SELECT ST_AsText(ST_Transform(way,4326)) FROM public.planet_osm_line where ST_INTERSECTS(ST_Transform(way,4326) ,ST_MakeEnvelope(1.379100, 43.563600,1.498600, 43.635200,4326)); – Ashie Feb 17 '14 at 9:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.