Hello! I have a following issue, I need to calculate the area of a rooftop of a building that I have searched for (I am considering only flat roofs). By querying OSM through Nominatim https://nominatim.openstreetmap.org/search/${query}format=json&addressdetails=1&limit=1&polygon_svg=1 I got a result with the coordinates of the nodes of the building. And as I have understand I need to use lat and long of that nodes and calculate the area of rooftop (received polygon). Can you suggest some alternate (easier) methods for this task (is there a possibility to query OSM and get that area without calculating it)? For example after querying I got this result: address: {house_number: "228", road: "Sõpruse pst", quarter: "Мустамяе", suburb: "Mustamäe linnaosa", city: "Tallinn", …} boundingbox: (4) ["59.400098", "59.4003983", "24.6893501", "24.6909638"] class: "building" display_name: "228, Sõpruse pst, Мустамяе, Mustamäe linnaosa, Tallinn, Таллин, Уезд Харьюмаа, 13414, Estonia" importance: 0.22100000000000003 lat: "59.400248149999996" licence: "Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright" lon: "24.690156937993393" osm_id: 26871853 osm_type: "way" place_id: 93502864 svg: "M 24.6893501 -59.4002007 L 24.6893999 -59.400098 24.6909638 -59.4002956 24.6909274 -59.4003705 24.6909139 -59.4003983 Z" type: "yes" asked 26 Oct '20, 18:10 armankulbek |
Nominatim imports full polygons for streets, landuse, cities, countries. For addresses Nominatim only imports the center point it doesn't import the building shape itself and thus can't return the size. If a building=yes is the address then during the import a center point is calculated and only that imported. When Nominatim returns a bounding box it's most likely calculated, e.g. "50 meter box around this center point". https://github.com/osm-search/Nominatim/blob/master/lib/PlaceLookup.php#L550 answered 26 Oct '20, 18:20 mtmail |