Skip to content

Commit

Permalink
Use NaN as default for missing Z/M values only for shape
Browse files Browse the repository at this point in the history
Not all providers supports using NaN
  • Loading branch information
domi4484 authored and 3nids committed Nov 15, 2022
1 parent f6b6f81 commit 505948b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/core/qgsvectorfilewriter.cpp
Expand Up @@ -2798,9 +2798,19 @@ gdal::ogr_feature_unique_ptr QgsVectorFileWriter::createFeature( const QgsFeatur
// add m/z values if not present in the input wkb type -- this is needed for formats which determine
// geometry type based on features, e.g. geojson
if ( QgsWkbTypes::hasZ( mWkbType ) && !QgsWkbTypes::hasZ( geom.wkbType() ) )
geom.get()->addZValue( std::numeric_limits<double>::quiet_NaN() );
{
if ( mOgrDriverName == QLatin1String( "ESRI Shapefile" ) )
geom.get()->addZValue( std::numeric_limits<double>::quiet_NaN() );
else
geom.get()->addZValue( 0 );
}
if ( QgsWkbTypes::hasM( mWkbType ) && !QgsWkbTypes::hasM( geom.wkbType() ) )
geom.get()->addMValue( std::numeric_limits<double>::quiet_NaN() );
{
if ( mOgrDriverName == QLatin1String( "ESRI Shapefile" ) )
geom.get()->addMValue( std::numeric_limits<double>::quiet_NaN() );
else
geom.get()->addMValue( 0 );
}

if ( !mGeom2 )
{
Expand Down

0 comments on commit 505948b

Please sign in to comment.