I understand now, sorry, so how about you read in three points and if the third 
point is in an exact line, then miss out the second point replacing it with the 
third and get the next point. You probably only want to remove those points 
that are exactly on the line. This is easy to spot when either one coordinate 
or the other stays fixed, but harder to spot if they are both changing. One 
thing to watch out for is if the next point is on the line, but between the 
other two points. As I mentioned in my other post, this could happen with 
doubling back. It might be easiest to iteratively remove what you call 
duplicates rather than do it all in one step. Anyway, good luck, it's a nice 
project :-)

Andy
http://www.geog.leeds.ac.uk/people/a.turner/
 

-----Original Message-----
From: Jason Ferguson [mailto:[email protected]] 
Sent: 24 May 2011 11:39
To: Andy Turner; [email protected]
Subject: Re: [Geotools-gt2-users] Properly Reducing Decimal Precision

Andy,

The problem is that when drawing a border, those points are along the
same line, so extra ones take up unnecessary rows in my database since
I'm flattening the shapefile into a table. Here's the list again, with
a new point added:

45.900, 178.353
45.900, 178.355
45.900, 178.361
45.900, 178.363
45.901.178.364

It would take up less space in my table to simplify to this list:

45.900, 178.353
45.901, 178.364

Jason

On Tue, May 24, 2011 at 2:13 AM, Andy Turner <[email protected]> wrote:
> Hi Jason,
>
> If your axes were orientated differently, you could get no numbers the same 
> in that list. The are all different coordinates, it is not like you keep 
> going backwards and forwards to the same points in the example you gave.
>
> Maybe I'm confused.
>
> Best wishes,
>
> Andy
>
>
>
> ________________________________
> From: Jody Garnett [[email protected]]
> Sent: 24 May 2011 03:58
> To: Jason Ferguson
> Cc: [email protected]
> Subject: Re: [Geotools-gt2-users] Properly Reducing Decimal Precision
>
> JTS does provided a Precision object you can use with a Gometry factory to 
> explicitly control precision. That combined with simplify geometry operations 
> should give you the control you need?
>
> Note we also make use of "decimation" to skip over points that would 
> otherwise render into the same pixel; perhaps that code could be a useful 
> example for you?
>
> While there is a page in the user guide 
> (http://docs.geotools.org/latest/userguide/library/jts/simplify.html) I could 
> really use a code example if you can produce one :-)
>
> --
> Jody Garnett
>
>
> On Tuesday, 24 May 2011 at 10:47 AM, Jason Ferguson wrote:
>
> I am attempting to store data from the TIGER/Line shapefiles into a
> database table, but am having issues with reducing the precision from
> the 5 decimal places to 3 decimal places.
>
> What I find is that after I dig down and get the coordinates, then
> eliminate duplicates, I'm left with a list of coordinates something
> like this (which I call semi-duplicates for lack of a better term):
>
> 45.900, 178.353
> 45.900, 178.355
> 45.900, 178.361
> 45.900, 178.363
>
> I end up with the same latitude, but several intermediate longitudes
> (or vice versa). I don't need all of these intermediate points, but I
> realize that this is an artifact of brute force rounding.
>
> Is there a "better" way to reduce the decimal precision?
>
> Jason
>
> ------------------------------------------------------------------------------
> vRanger cuts backup time in half-while increasing security.
> With the market-leading solution for virtual backup and recovery,
> you get blazing-fast, flexible, and affordable data protection.
> Download your free trial now.
> http://p.sf.net/sfu/quest-d2dcopy1
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]<mailto:[email protected]>
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>

------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to