Skip to content

Commit

Permalink
Reverted BE changes
Browse files Browse the repository at this point in the history
Signed-off-by: Emil Balitzki <[email protected]>
  • Loading branch information
Corgam committed Jul 12, 2024
1 parent 4f6e610 commit 53f04de
Showing 1 changed file with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,21 @@ public string GetDataInsideArea(BoundingBox boundingBox)
if (!ApiHelper.BoxIntersection(boundingBox, table.BoundingBox.Value))
{
var bb = table.BoundingBox.Value;
// Console.WriteLine($"request-- x: {boundingBox.minX}, y: {boundingBox.minY} || x: {boundingBox.maxX}, y: {boundingBox.maxY}");
// Console.WriteLine($"x: {bb.minX}, y: {bb.minY} || x: {bb.maxX}, y: {bb.maxY}");
continue;
}

// bounding boxes intersect.
// get data

// SQL Query to find intersecting points

var sqlQuery = $"SELECT top 1000 Location.AsTextZM() AS Location, Location.STGeometryType() AS Type" +
ApiHelper.FromTableIntersectsPolygon(table.Name, polygon);

foreach (var row in DbHelper.GetData(sqlQuery))
{
// Define the properties of each data object
var properties = new Dictionary<string, object>
{
{ "type", $"{row["Type"]}" }
};
// Add more properties if they exist
if (row.ContainsKey("nutzart"))
{
properties.Add("usageType", $"{row["nutzart"]}");
}
// Create the feature
var feature = new Dictionary<string, object>
{
{ "type", "Feature" },
Expand All @@ -75,7 +71,12 @@ public string GetDataInsideArea(BoundingBox boundingBox)
}
}
},
{ "properties", properties }
{
"properties", new Dictionary<string, object>
{
{ "text", $"{row["Type"]}" }
}
}
};

features.Add(feature);
Expand All @@ -91,4 +92,4 @@ public string GetDataInsideArea(BoundingBox boundingBox)

return JsonSerializer.Serialize(responseObj);
}
}
}

0 comments on commit 53f04de

Please sign in to comment.