Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/api/interpreter does not respond after initial clone, times out with 504 #130

Open
Ronaldoshuang opened this issue Nov 11, 2024 · 4 comments

Comments

@Ronaldoshuang
Copy link

Ronaldoshuang commented Nov 11, 2024

With the following docker-compose.yml file, after initially cloning and then restarting the service, the logs indicate that everything starts up correctly.
When I make an API call however, the service only responds with an HTTP 504 gateway timeout.
image

The logs after the second startup of the service (after clone)
image

@wiktorn
Copy link
Owner

wiktorn commented Nov 11, 2024

Does it work, if you try with very small extract, like Monaco?

@Ronaldoshuang
Copy link
Author

Thank you for your timely reply. I used the 0.7.56.9 version of the image before, changed it to the latest image, and then accessed /api/interpreter, and then reported the error open64: 13 Permission denied /db/db//osm3s_osm_base Unix_Socket::7, Later, enter the container and run the chmod og+rx /db command. The problem is solved and you can access and use it normally. I hope OVERPASS_PLANET_URL can be modified to read local files, otherwise downloading data will be too slow. thank you

@Ronaldoshuang
Copy link
Author

Now I am encountering new problems, visit http://172.16.10.65:12345/api/interpreter?data=[out:xml][bbox:30.52116,104.04774,30.54482,104.07829]; ( node; way; relation; ); out meta;, error runtime error: open64: 2 No such file or directory /db/db/user_data.bin File_Blocks::File_Blocks::1
, where is the user_data.bin file downloaded? Visit https://overpass-api.de/api/interpreter?data=[out:xml][bbox:30.52116,104.04774,30.54482,104.07829];
(
node;
way;
relation;
);
out meta; you can download the file normally

@Ronaldoshuang
Copy link
Author

Ronaldoshuang commented Nov 12, 2024

`
import java.io.BufferedInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

public class OverpassAPI {

public static void main(String[] args) {
    // 设置 Overpass API URL

// String url = "http://overpass-api.de/api/interpreter";
// String url = "http://172.16.10.65:12345/api/interpreter";
String url = "http://172.16.20.23:12345/api/interpreter";

    double latMin = 30.52116;
    double lonMin = 104.04774;
    double latMax = 30.54482;
    double lonMax = 104.07829;

    String query = String.format("""
            [out:xml][bbox:%f,%f,%f,%f];
            (
              node;
              way;
              relation;
            );
            out meta;
            """, latMin, lonMin, latMax, lonMax);

    try {
        // 对查询字符串进行 URL 编码
        String encodedQuery = URLEncoder.encode(query, StandardCharsets.UTF_8);

        // 设置连接
        HttpURLConnection connection = (HttpURLConnection) new URL(url + "?data=" + encodedQuery).openConnection();
        connection.setRequestMethod("GET");

        // 检查响应码
        int responseCode = connection.getResponseCode();
        if (responseCode == HttpURLConnection.HTTP_OK) {
            // 获取输入流并保存为 OSM 文件
            try (InputStream in = new BufferedInputStream(connection.getInputStream());
                 OutputStream out = new FileOutputStream("OverpassAPI.osm")) {
                byte[] buffer = new byte[1024];
                int bytesRead;
                while ((bytesRead = in.read(buffer)) != -1) {
                    out.write(buffer, 0, bytesRead);
                }
                System.out.println("OSM 数据已成功保存到 OverpassAPI.osm 文件中!");
            }
        } else {
            System.out.println("请求失败,响应码: " + responseCode);
        }
    } catch (IOException e) {
        System.err.println("发生错误: " + e.getMessage());
    }
}

}
`
image
image

I have been trying to solve this problem all day, but still haven't gained anything. I don't know which step went wrong, please help me. Thank you very much, I entered the container and indeed did not have the user_data.bin file,Where can I download the user_data.bin file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants