Paragon Corporation wrote:
Iulian,

Hmm not sure how much of a noob you are since the below looks kind of
 sophisticated for a newbie with some minor syntactical errors Should
be and my parethesis may be off

My first contact with GIS was a few days a go, but i've done lots of
reading and tests these few days ... still i feel like a noob. ( and i went from think geo to NetTopologySuite to PostGIS

select (st_dump( (select  ST_SimplifyPreserveTopology (
st_collect(the_geom),0.01) from zipcodes ))).geom

1) Question 1 - This assumes you are a total noob. Did you add a
spatial index to your geometry?
> 2) Question 2 - Might help to cluster
on that index as well since this is a pretty static table I assume.

I already had the index added, clustering did non made noticeable improvements. The data is around 450Mb so i guess no meter how is indexed it will take time to move it from the db to a bitmap.

3) Where did you get these zipcodes from?  I know for example US
zipcodes are not that large as far as complexity goes (though they
are large in area), so I am questioning why they need to be
simplified in the first place unless you are trying to display all of
them at once on the screen.

They wore already used in this project i'm working on, but i'll try to get more details and maybe a "simplified" version can be obtained.


4) Regarding the below whether it is sane to do that - I would say
probably not, but I could be wrong.

The reason I say no is that that if you collect the geometries first
and then simplify, I think even simplifypreserve will loop thru each
geometry anyway and simplify.  Though I'm not absolutely positive of
that.  So the whole exercise of collect simplify dump is a bit
fruitless if that was your intention.  Not a bad thought and maybe
you are right so maybe someone can correct me on that.

I don't see how it could preserve topology ( witch i've understood it means it will keep the same number of "holes" ) by working independently on every zipcode... but it's very possible that i'm wrong.

5) If you are getting too many gaps, you may just want to lower your
0.01 to 0.001 or 0.005.  The basic idea being the more you simplify
the more gaps you will get, but the less noticeable they are the
further away the observer is - so for deep in zoom you want no
simplification and for far out you want lots of simplification.

> Oops I forgot one important point. DO NOT simplify In longlat projection.
> You get somewhat bizarre results and that may be perhaps what you are
> experiencing.
>
> I think you will want to reproject to a planar project and then project back
>
> So
>
> SELECT
> ST_Transform(ST_SimpilfyPreserverTopology(ST_Transform(the_geom,2163),
> 100),4326) As newsimpgeom
> FROM zipcode;
>
> (2163 is US National Atlas meters so you may need to change that, and 4326 > is WGS 84 longlat. If you got zips from census you may need to change that
> to 4269 NAD 83 long lat).
>
> You'll also need to play around with the simplification metric.
>

Now this is something i've got to try.

Thanks for your ideas,
Iulian


_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to