[gdal-dev] [ogr] Unexplained third dimension in linear ring
Chaitanya kumar CH
chaitanya.ch at gmail.com
Fri Jan 14 11:07:56 EST 2011
Alex,
I thought of pretty much the same modification. But it could potentially
break some software. It may be added in 1.8 which is in the process of being
released but I doubt it. Please file the ticket.
On Fri, Jan 14, 2011 at 9:27 PM, Alex Hagen-Zanker <ahh34 at cam.ac.uk> wrote:
>
> The problem seems to be that adding a 2D OGRPoint to a 2D OGRLinearRing
>> results in a 3D OGRLinearRing.
>>
>
> Sorry to bother you with this, I found it myself.
> It is the following function in ogrlinestring.cpp that looks like a bug to
> me:
>
> void OGRLineString::setPoint( int iPoint, double xIn, double yIn, double
> zIn )
>
> {
> if( getCoordinateDimension() == 2 )
> Make3D();
>
> if( iPoint >= nPointCount )
> setNumPoints( iPoint+1 );
>
> paoPoints[iPoint].x = xIn;
> paoPoints[iPoint].y = yIn;
>
> if( zIn != 0.0 )
> {
> Make3D();
> padfZ[iPoint] = zIn;
> }
> else if( getCoordinateDimension() == 3 )
> {
> padfZ[iPoint] = 0.0;
> }
> }
>
> How about changing it to this:
>
> void OGRLineString::setPoint( int iPoint, double xIn, double yIn, double
> zIn )
>
> {
> if( iPoint >= nPointCount )
> setNumPoints( iPoint+1 );
>
> paoPoints[iPoint].x = xIn;
> paoPoints[iPoint].y = yIn;
>
> if( zIn != 0.0 && getCoordinateDimension() < 3 )
> Make3D();
>
> if( getCoordinateDimension() == 3 )
> padfZ[iPoint] = zln;
>
> }
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
--
Best regards,
Chaitanya kumar CH.
/tʃaɪθənjə/ /kʊmɑr/
+91-9494447584
17.2416N 80.1426E
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110114/0c9fd9d6/attachment-0001.html
More information about the gdal-dev
mailing list