Skip to content

polygons i kart + egen route close #63 - #328

Open
DipakS100 wants to merge 7 commits into
developfrom
feature/63-polygoner-visning-i-kart
Open

polygons i kart + egen route close #63#328
DipakS100 wants to merge 7 commits into
developfrom
feature/63-polygoner-visning-i-kart

Conversation

@DipakS100

Copy link
Copy Markdown
Contributor

No description provided.

DipakS100 added 2 commits July 2, 2026 22:08
Artskart3.Tests.Integration.Tests.EndpointCoverageTests
[Produces("application/json")]
[ProducesResponseType(typeof(IEnumerable<LocationPolygonDto>), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
public async Task<ActionResult<IEnumerable<LocationPolygonDto>>> GetLocationPolygons(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hvorfor ekskluderer vi rektangler/kvadrat? Er ikke disse sensitive funn som også skal vises?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ekskluder skjulte funn, rektangler/kvadrat, litt usikker skal sjekke

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

@kennethaamodt kennethaamodt Jul 3, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@Kristoffer-Martinsen

Copy link
Copy Markdown
Contributor
bilde

Er det mulig å tegne polygonene under punktene? Blir litt vanskelig å se tallene i clusters når det er flere plogyner på samme sted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants