[gdal-dev] weeding out x,y,z points

Ari Jolma ari.jolma at tkk.fi
Thu Feb 26 01:10:46 EST 2009

nicholas.g.lawrence at mainroads.qld.gov.au wrote:
>> nicholas.g.lawrence at mainroads.qld.gov.au wrote:
>>> A client has a very large (millions of records) ascii file consisting
>>> solely of x,y,z co-ordinates.
>>> They would like to reduce the number of records by weeking out points that
>>> are too close to each other.
>>> Can GDAL or OGR weed out 3D points based on proximity to each other?
> My client says that they want the resulting data points to be
> a subset of the original data points, that is the process should
> delete points, not re-calculate new ones that are an average.

I would use plain Perl (or Python or high level language X) to read in 
the points sequentially and discard new ones that are "too close" to 
existing ones. It may take a while & require a bit of memory it is 
probably doable that way (millions of points but not 100s of millions in 
the end set). The program shouldn't need to be more than 20 lines I guess.

This is doable in plain programming language since distance is so easy 
to compute. If you had polygons or linestrings then GDAL+GEOS would be 
natural additional tools.


More information about the gdal-dev mailing list