Quantcast

Reducing precision in Coordinates

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Reducing precision in Coordinates

Lee Goddard-3-3
To try and reduce the size of my KML export, I would like to reduce the
precision of my coordinates, which are currently to 13 decimal places.

Is there a JTS way to do this, or will I have to pre-process my data?

Thanks in anticipation
Lee
_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Reducing precision in Coordinates

Martin Davis
Have a look at SimpleGeometryPrecisionReducer.

The only downside to using this class is that it doesn't absolutely
guarantee that the reduced polygon willl be valid (in certain situations
moving coordinates by a small amount can produce self-intersections).  
If you're just exporting to KML this probably doesn't matter - in my
experience, Google tools are pretty tolerant of "slightly invalid"
polygons.  Or you can always use buffer(0) to clean up the problem.

Lee Goddard wrote:

> To try and reduce the size of my KML export, I would like to reduce
> the precision of my coordinates, which are currently to 13 decimal
> places.
>
> Is there a JTS way to do this, or will I have to pre-process my data?
>
> Thanks in anticipation
> Lee
> _______________________________________________
> jts-devel mailing list
> [hidden email]
> http://lists.refractions.net/mailman/listinfo/jts-devel
>

--
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022

_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Reducing precision in Coordinates

Lee Goddard-3-3

Thanks very much.

Martin Davis wrote:

> Have a look at SimpleGeometryPrecisionReducer.
>
> The only downside to using this class is that it doesn't absolutely
> guarantee that the reduced polygon willl be valid (in certain
> situations moving coordinates by a small amount can produce
> self-intersections).  If you're just exporting to KML this probably
> doesn't matter - in my experience, Google tools are pretty tolerant of
> "slightly invalid" polygons.  Or you can always use buffer(0) to clean
> up the problem.
>
> Lee Goddard wrote:
>> To try and reduce the size of my KML export, I would like to reduce
>> the precision of my coordinates, which are currently to 13 decimal
>> places.
>>
>> Is there a JTS way to do this, or will I have to pre-process my data?
>>
>> Thanks in anticipation
>> Lee

_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel
Loading...