I was tried to get OSM data from my local overpass API. There are four steps to get OSM data.
- run the binary file
/srv/osm3s/bin/osm3s_query
- once the osm3s_query is running, you'll see this message
encoding remark: Please enter your query and terminate it with CTRL+D.
- input your query
<query type="node"><bbox-query n="51.0" s="50.9" w="6.9" e="7.0"/><has-kv k="amenity" v="pub"/></query><print/>
- press ctrl+D and get the OSM results
my code as below:
try
{
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("/srv/osm3s/bin/osm3s_query");
InputStream stderr = proc.getErrorStream();
InputStreamReader isr = new InputStreamReader(stderr);
BufferedReader br = new BufferedReader(isr);
String line = null;
while ( (line = br.readLine()) != null)
System.out.println(line);
int exitVal = proc.waitFor();
System.out.println("Process exitValue: " + exitVal);
} catch (Throwable t)
{
t.printStackTrace();
}
The process will hang on step 2 after shown the message encoding remark: Please enter your query and terminate it with CTRL+D.
. I have no idea how to give the process the query string.
Anybody has some idea?