polygons i kart + egen route close #63 - #328
Conversation
Artskart3.Tests.Integration.Tests.EndpointCoverageTests
| [Produces("application/json")] | ||
| [ProducesResponseType(typeof(IEnumerable<LocationPolygonDto>), StatusCodes.Status200OK)] | ||
| [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||
| public async Task<ActionResult<IEnumerable<LocationPolygonDto>>> GetLocationPolygons( |
There was a problem hiding this comment.
Kanskje greit å sende med envelopen som vi gjør med punkter? Da henter vi ikke alle polygonene, men bare de som vises på skjermen.
| /// <summary> | ||
| /// Retrieves polygon geometries from the Location table for observations matching the filter. | ||
| /// Only Polygon and MultiPolygon geometry types are returned. | ||
| /// Rectangular/square polygons (grid-cell precision squares) are excluded automatically. |
There was a problem hiding this comment.
Hvorfor ekskluderer vi rektangler/kvadrat? Er ikke disse sensitive funn som også skal vises?
There was a problem hiding this comment.
ekskluder skjulte funn, rektangler/kvadrat, litt usikker skal sjekke
There was a problem hiding this comment.
Ser ikke noen grunn til å ekskludere skjulte funn. De skal vises de også
|
|
||
| var locations = await _context.Set<Location>() | ||
| .AsNoTracking() | ||
| .Where(l => locationIds.Contains(l.Id) && l.Geometry != null && l.Geometry.NumPoints > 5) |
There was a problem hiding this comment.
Her kan vi legge til && (l.Geometry.GeometryType == "Polygon" || l.Geometry.GeometryType == "MultiPolygon") å få sql til å filtrere. da trenger vi ikke sjekkene på linje 673 og 675 (null check og geometritype)
| var locations = await _context.Set<Location>() | ||
| .AsNoTracking() | ||
| .Where(l => locationIds.Contains(l.Id) && l.Geometry != null && l.Geometry.NumPoints > 5) | ||
| .ToListAsync(cancellationToken); |
There was a problem hiding this comment.
Hent ut kun felter vi trenger:
.Select(l => new { l.Id, l.Locality, l.Geometry })
Da kan vi også forenkle foreach loopen litt:
foreach (var location in locations)
{
if (IsAxisAlignedRectangle(location.Geometry!))
{
continue;
}
result.Add(new LocationPolygonDto
{
LocationId = location.Id,
Locality = location.Locality,
WktPolygon = location.Geometry!.AsText(),
ObservationCount = countLookup.GetValueOrDefault(location.Id)
});
}
| { | ||
| try | ||
| { | ||
| filter ??= new LocationSearchFilterDto(); |
There was a problem hiding this comment.
Vi burde kanskje være litt mer aggresive på antall resultater for polygoner. Vil tro 100 000 polygoner er litt mye, så vi kunne ha hatt lavere maxresults for disse?
…com/Artsdatabanken/Artskart3 into feature/63-polygoner-visning-i-kart

No description provided.