This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Own Nominatim Server gives no JSON output in Curl

0

Hello,

my own nomination server works well. In Chrome I get my JSON output:

[
    {
        "place_id": "6781110",
        "licence": "Data © OpenStreetMap contributors, ODbL 1.0. https://www.openstreetmap.org/copyright",
        "osm_type": "way",
        "osm_id": "35776867",
        "boundingbox": [
            "52.5531628",
            "52.5534904",
            "13.3737733",
            "13.3743485"
        ],
        "lat": "52.55333255",
        "lon": "13.3739065743598",
        "display_name": "20, Gottschedstraße, Gesundbrunnen, Mitte, Berlin, 13357, Deutschland",
        "class": "building",
        "type": "yes",
        "importance": 0.101
    }
]

but in my linux bash I get with: curl -H "Content-type: text/html; charset=UTF-8" http://sgwtest.ddns.net/nominatim/search.php?q=13357+gottschedstraße+20&format=json

I get only the HTML-part like:

<!DOCTYPE html> <html lang="en"> <head>
    <title>OpenStreetMap Nominatim: Search</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <base href="/nominatim/" />
    <link href="nominatim.xml" rel="search" title="Nominatim Search" type="application/opensearchdescription+xml" />
    <link href="css/leaflet.css" rel="stylesheet" />
    <link href="css/bootstrap-theme.min.css" rel="stylesheet" />
    <link href="css/bootstrap.min.css" rel="stylesheet" />
    <link href="css/common.css" rel="stylesheet" type="text/css" />
    <link href="css/search.css" rel="stylesheet" type="text/css" /> </head>

But why? In chrome it works very well, why not with curl

asked 19 Nov '16, 22:24

hevilp's gravatar image

hevilp
31558
accept rate: 0%


One Answer:

5

If you have really entered the curl command as written, then your shell has cut off everything after the first & which on Unix is traditionally a way to end a command and send it to the background. You have to add quotes around the URL, like so:

curl "http://sgwtest.ddns.net/nominatim/search.php?q=13357+gottschedstraße+20&format=json"

answered 19 Nov '16, 23:46

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

this helped, thank you!

(20 Nov '16, 08:53) hevilp

Source code available on GitHub .