Sql to get all streetnames and POIs from a city

Hello,

I imported a osm-file into a PostgreSQL-DB, now I want to do a query with the same: Getting all streetnames and/or POIs of a given city.

I found some people saying, that it’s not possible, but it’s exactly what http://www.maposmatic.org/ for example is doing: With every rendered map of a city you get a list of streetnames and POIs of exactly this city. So how can it be done?

I didn’t find any good tutorials for using OpenStreetMap directly with a database, if you have additional infos or places where to learn more I would be grateful.

Have a look at http://wiki.openstreetmap.org/wiki/Overpass_API … you can do queries from a copy of the main OSM server without having an own database.

To get some more hints, do a search for “overpassAPI” streets, cities, places, list etc or similar at http://help.openstreetmap.org