Sorry if this isn't strictly a GIS question. I want to know if there's a public database of US streets and US States that I can simply connect to (e.g. JDBC) and run SQL queries. For example, I want to find all the streets named "California" in the state of California. I've read about Gisgraphy and OpenStreetMaps and Geonames, but I don't see how to do the kind of query I'm talking about.
-
1Which database you want to use? If it is OK to use Postgres and PostGIS, then you can use osm2postgis for this. You can then easily connect your database using JDBC driver– thelastrayMar 7, 2013 at 4:56
-
I may be wrong but you can try through WMS tigerweb.geo.census.gov/tigerwebmain/TIGERweb_wms.html and sql query through wms (mindland.com/wp/…)– SunilMar 7, 2013 at 5:13
2 Answers
I very much doubt there is any such thing - SQL database servers aren't really suitable for this kind of public-facing surface. For example, Denial of Service attacks are usually pretty trivial to construct if you allow arbitrary SQL.
There are other APIs (e.g. the overpass API and nominatim) for OpenStreetMap, but not SQL.
If by public database you mean public server, I agree with BradHards. You still can donwload the USA .osm file and use it for free (it is a "collaborative effort", which makes it quite public). Then you extract the data to a postgis/postgresql database and you can send as many requests as you want!
Pay attention to the fact that osm2psql (or the equivalent you will use) may have particular options for geocoding...