I'm trying to find a building closest to a given (lat, long) within
some radius (say, 50 meters). For example, I want to examine point
(57.45366, 10.019616). For that, I issue the following DAWA API request:
The answer is:
}So, the coordinates of the building are (57.45294072, 10.02005771) which is ~84 meters away from the point i'm testing. But, if we look at the map:https://www.google.com/maps/place/57%C2%B027'13.2%22N+10%C2%B001'10.6%22Efirstname.lastname@example.org,10.0201285,19z/data=!4m5!3m4!1s0x0:0x0!8m2!3d57.45366!4d10.019616we can see that the building is clearly within 50 meters to the point. The reason we get distance 84 meters is that the building coordinates are taken from its opposite side and the building is fairly big.So, in fact, in order to find the correct distance from a point to a building, we need to know the building's polygon, not just one point. I was looking through DAWA API documentation, but was not able to find a way to obtain this information. Partly, because Danish is not my native language :).Any help is greatly appreciated.Best regards,Dmytro.
Use the Bygnings API:
The documentation: https://dawa.aws.dk/dok/api/bygning
thanks for the quick answer. This API looks very much like what i
need. The only thing that is missing is the building's address. I've
tried https://dawa.aws.dk/bygninger/101771699, but
that only returns zip code & city name, no street name/house number.
In fact, after some thinking: I may not need the building's polygon.
What I really need is the "true" distance from my point to
the building that takes into account the building's shape (polygon)
and not just some arbitrary lat/lng within it. Also, I need the
address of that building - at the end, the address is what I'm looking
for here. If you think about it - that is how reverse geocoding should
work: it should consider addresses as polygons and not as points +
return the true distance (or have a "radius" parameter).
The building API gives you the access addresses (adgangsadresser) contained in the building's polygon. The access addresses (adgangsadresser) are not included in the "flat" format. You can use the parameter struktur=nested:
In your example, the building is not associated with any address, but if you look at, for example, this:
Not all buildings have an address, and not all addresses refer to a building.