-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
arc_length levert null values op #737
Comments
In DynamicPoint.h line 19 the ArcLength function is defined as: template <typename ReturnType, typename ConstPointPtr>
ReturnType ArcLength(ConstPointPtr arcPtr, ConstPointPtr arcEnd)
{
if (arcPtr == arcEnd)
return 0;
ReturnType length = 0;
assert(arcPtr != arcEnd);
if (!IsDefined(*arcPtr))
return UNDEFINED_VALUE(ReturnType);
for (ConstPointPtr nextPtr = arcPtr; ++nextPtr != arcEnd; arcPtr = nextPtr)
{
if (!IsDefined(*nextPtr))
return UNDEFINED_VALUE(ReturnType);
length += std::sqrt(SqrDist<ReturnType>(*arcPtr, *nextPtr));
}
return length;
} As can be seen from the definition of ArcLength it returns null for length if the whole input Attribute or any of the individual points is null. |
Maar waardoor worden die null.null geometrieen dan veroorzaakt. QGIS heeft daar geen last van kennelijk en kan wel een lengte berekenen. |
QGIS berekent de lengte als volgt in qgsgeometrycollection.cpp: double QgsGeometryCollection::length() const
{
double length = 0.0;
QVector< QgsAbstractGeometry * >::const_iterator geomIt = mGeometries.constBegin();
for ( ; geomIt != mGeometries.constEnd(); ++geomIt )
{
length += ( *geomIt )->length();
}
return length;
} Waar geen rekening wordt gehouden met null in de geometrie punten lijst, het is een keuze van implementatie lijkt mij. @MaartenHilferink |
Dat zouden we moeten uitzoeken, het hoeft dus niet zo te zijn dat QGIS geen null.null geometrieen tegen komt maar dat ze er anders mee om gaat. Ik haal de configuratie op en bekijk het nader. |
prima dank |
De oplossing zou zijn om de multilinestrings naar linestrings + relatie te converteren met de split_multi_linestring functie. Echter lijkt er iets mis te gaan met conversie: |
is prima dank dat je hier tijd voor kan maken |
De route die ik boven aan gaf van split_multi_linestring zou moeten werken, en past @MaartenHilferink aan. Verder is er een directere functie bij gekomen namelijk mls_length, zie hieronder hoe deze te gebruiken: unit<uint32> cube2024
: StorageName = "%RSLDataDir%/Infrastructuur/NRMLMS/2024/PM_LMS_CUBE_24_05_01_22_21_v2.gpkg"
, StorageType = "gdal.vect"
, StorageReadOnly = "True"
, Source = "Python script Martijn Spoon Y:\Project\M500303_Monitor_Infrastructuur_en_Ruimte\Data\Planmonitor2024\Data\LMS PM_LMS_CUBE_24_05_01_22_21.gpkg"
"length berekend in QGIS 3.34.2-Prizren Add geometry attributes ivm met probleem arc_length"
, SqlString = "SELECT * FROM PM_LMS_CUBE_24_05_01_22_21_v2 WHERE NieuwTrace=1"
{
attribute<rdc_meter> geometry (arc);
attribute<meter> length := mls_length(geometry, meter);
attribute<meter> road_length:= arc_length(geometry, meter);//null values itt tot length berekend in QGIS 3.34.2-Prizren Add geometry attributes nieuw gpkg bestand met extra veld length
attribute<fpoint> arc_buffer(poly) := bg_buffer_linestring(geometry, 25.0, 16b);
attribute<.> Per_domain (Domain) := poly2grid(arc_buffer, domain);
attribute<bool> IsTrace (Domain) := IsDefined(Per_domain);
} Resulterende length attribute bevat geen nulls meer: |
mls_length is inderdaad beschikbaar; split_multi_linestring was alleen beschikbaar voor DPolygons, sequences van DPoints; vanaf 15.2.0 ook voor de andere Point sequences, d.w.z.: FPolygon, IPolygon, UPolygon, WPolygon, en SPolygon. en de functie split_multi_numberstring voor numeric sequences. |
…on, IPolygon, UPolygon, WPolygon, and SPolygon (was: only DPolygon), and split_numericstring for all sequences of numbers.
GeoDMS 15.1.0
PD 10936: https://pbl.sliksvn.com/ruimtescanner/PBL/ProjDir/branches/PlanMonitor2024
SD 10937:https://pbl.sliksvn.com/ruimtescanner/PBL/SourceData/Trunk/RSL
Open casus.dms
items:
/SourceData/Beleid2024/OmgRecht/NRMLMS/cube2024/geometry
/SourceData/Beleid2024/OmgRecht/NRMLMS/cube2024/road_length
/SourceData/Beleid2024/OmgRecht/NRMLMS/cube2024/length (in QGIS berekend)
Lijkt erop dat als in het geometry-veld null values voorkomen de arc_length null oplevert. zie ook screendump
The text was updated successfully, but these errors were encountered: