Loading…
Tilbage

Profilbillede

Reverse geocoding for roads and GeoJSON

Dmytro Gokun

Hi,

 

I'm trying to use the reverse geocoding API for roads. I need to use GeoJSON format (because I need geometry to assess the distance). That works fine with one small cavite: the data returned is not the same as with JSON format. Particularly, "postal code" & "postal code" are missing.

 

Example.

When I call  http://dawa.aws.dk/vejstykker/reverse?x=12.5851471984198&y=55.6832383751223, I get  the following back:

{
  "href": "http://dawa.aws.dk/vejstykker/101/4112",
  "kode": "4112",
  "navn": "Landgreven",
  "adresseringsnavn": "Landgreven",
  "kommune": {
    "href": "http://dawa.aws.dk/kommuner/0101",
    "kode": "0101",
    "navn": "København"
  },
  "postnumre": [
    {
      "href": "http://dawa.aws.dk/postnumre/1301",
      "nr": "1301",
      "navn": "København K"
    }
  ],
  "historik": {
    "oprettet": "2010-01-17T11:17:29.847",
    "ændret": "2010-01-17T11:17:29.847"
  }
}


But when I call http://dawa.aws.dk/vejstykker/reverse?x=12.5851471984198&y=55.6832383751223&format=geojson , I get the following back:

{
  "type": "Feature",
  "geometry": {
    "type": "MultiLineString",
    "coordinates": [
      [
        [
          12.58496049,
          55.68340668
        ],
        [
          12.58485933,
          55.68343346
        ]
      ],
      [
        [
          12.58479801,
          55.68321405
        ],
        [
          12.58469454,
          55.68324163
        ],
        [
          12.58458474,
          55.68327136
        ]
      ],
      [
        [
          12.58654053,
          55.68298758
        ],
        [
          12.58648119,
          55.68300343
        ],
        [
          12.58504035,
          55.68338546
        ],
        [
          12.58496049,
          55.68340668
        ]
      ],
      [
        [
          12.58637409,
          55.68279337
        ],
        [
          12.58631941,
          55.68280801
        ],
        [
          12.58487382,
          55.68319376
        ],
        [
          12.58479801,
          55.68321405
        ]
      ],
      [
        [
          12.58642737,
          55.68277913
        ],
        [
          12.58637409,
          55.68279337
        ]
      ],
      [
        [
          12.58658949,
          55.68297473
        ],
        [
          12.58654053,
          55.68298758
        ]
      ]
    ]
  },
  "crs": {
    "type": "name",
    "properties": {
      "name": "EPSG:4326"
    }
  },
  "properties": {
    "kode": "4112",
    "kommunekode": "0101",
    "oprettet": "2010-01-17T11:17:29.847",
    "ændret": "2010-01-17T11:17:29.847",
    "kommunenavn": "København",
    "navn": "Landgreven",
    "adresseringsnavn": "Landgreven"
  }
}


As you can see the postnumre information is missing. Is this a bug? Is there any chance this will be fixed?

Best regards,
Dmytro.
ændret af Dmytro Gokun (27.03.2018)

Hi Dmytro

Use the query parameter struktur=nestet:

http://dawa.aws.dk/vejstykker/reverse?x=12.5851471984198&y=55.6832383751223&format=geojson&struktur=nestet

We apologize for the lack of documentation.

Regards
Finn

 

Hi Finn,

 

Actually, there is documentation. It's just me, who foolishly translated the whole thing to English and tried "flat" & "nested" instead of "flad" & "nestet" (that, obviously, did not work) :).

 

Thanks a lot for the quick answer!

 

Dmytro.