OK works- thanks.<div><br></div><div>So I'm learning now about the difference between what MapShaper does and what ST_Stimplify does. Is there any way to make sure that simplified boundary lines will match other boundary lines? i.e. even the smallest simplifications (like 0.05) produces very visible gaps between adjacent districts.</div>
<div><br></div><div><br><br><div class="gmail_quote">On Tue, Jun 28, 2011 at 1:12 PM, Sandro Santilli <span dir="ltr"><<a href="mailto:strk@keybit.net">strk@keybit.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Christian,<br>
I suggest you create a new geometry field w/out enforcing type constraints<br>
on it, write the simplified version in there and then see what you get.<br>
<br>
--strk;<br>
<div><div></div><div class="h5"><br>
On Tue, Jun 28, 2011 at 12:15:13PM -0400, Christian Guirreri wrote:<br>
> Same error. Tried both Polygon and Multipolygon. I'm not sure which the<br>
> Tiger Data is.<br>
><br>
> On Tue, Jun 28, 2011 at 11:41 AM, Ben Madin<br>
> <<a href="mailto:lists@remoteinformation.com.au">lists@remoteinformation.com.au</a>>wrote:<br>
><br>
> > Christian,<br>
> ><br>
> > My guess here is that because you've told the geometry to be a<br>
> > MULTIPOLYGON, but you may have returned a POLYGON, you have indeed violated<br>
> > the check constraint on the geometry type.<br>
> ><br>
> > try using st_multi() to get around it, as in :<br>
> ><br>
> > update public.tl_2010_us_cd111 set simple_geom =<br>
> > ST_Multi(ST_SimplifyPreserveTopology(the_geom, 15));<br>
> ><br>
> ><br>
> > cheers<br>
> ><br>
> > Ben<br>
> ><br>
> ><br>
> ><br>
> > On 28/06/2011, at 11:23 PM, Christian Guirreri wrote:<br>
> ><br>
> > I get the following error:<br>
> > ERROR: new row for relation "tl_2010_us_cd111" violates check constraint<br>
> > "enforce_geotype_simple_geom"<br>
> > SQL state: 23514<br>
> ><br>
> > Here's my SQL:<br>
> > select addGeometryColumn('public', 'tl_2010_us_cd111', 'simple_geom', 4326,<br>
> > 'MULTIPOLYGON', 2);<br>
> > update public.tl_2010_us_cd111 set simple_geom =<br>
> > ST_SimplifyPreserveTopology(the_geom, 15);<br>
> ><br>
> ><br>
> > On Mon, Jun 27, 2011 at 2:07 PM, Stephen Woodbridge <<br>
> > <a href="mailto:woodbri@swoodbridge.com">woodbri@swoodbridge.com</a>> wrote:<br>
> ><br>
> >> On 6/27/2011 1:37 PM, Christian Guirreri wrote:<br>
> >><br>
> >>> I'm trying to do something fairly simple. I'd like to take the Tiger<br>
> >>> 2010 Data - tl_2010_us_cd111 and tl_2010_us_county10 - and create shape<br>
> >>> files that are considerably smaller and more simplified. In the past<br>
> >>> I've just used MapShaper and been OK with that, but I was having trouble<br>
> >>> uploading tl_2010_us_county10 into it and I've decided its time to learn<br>
> >>> some GIS basics anyway.<br>
> >>><br>
> >>> I've definitely successfully setup my environment - PostegreSQL 9 with<br>
> >>> PostGIS. I've used the shp2pgsql wizard included with pgadmin to import<br>
> >>> the data sets into their own databases, without the "Load Geography<br>
> >>> column" checked. I've been able to export this data back to shp<br>
> >>> using pgsql2shp and view the resulting shp in QuantumGIS and ACDSee<br>
> >>> Canvas.<br>
> >>><br>
> >>> But when it comes to simplification - I'm not sure where to even<br>
> >>> start. I'm no database expert beyond some simple mysql so GIS is<br>
> >>> especially overwhelming. I only know that I want to<br>
> >>> use ST_SimplifyPreserveTopology() as I'm fairly certain a number of<br>
> >>> things will disappear if I don't.<br>
> >>><br>
> >>> Would love if someone could provide me with the SQL to make this happen!<br>
> >>><br>
> >><br>
> >> First you should understand that ST_SimplifyPreserveTopology() works on a<br>
> >> single geometry at a time and not on multiple geometries in a coverage. The<br>
> >> difference is in a coverage the the polygons that share a common edge that<br>
> >> is simplified would continue to have a common simplified edge. When polygons<br>
> >> are simplified individually with knowledge of the adjacent polygons it is<br>
> >> possible for gaps and overlaps to occur along the simplified edge.<br>
> >> ST_SimplifyPreserveTopology() is designed to try and minimize these effects<br>
> >> but there are no guarantees.<br>
> >><br>
> >> You might try something like:<br>
> >><br>
> >> select addGeometryColum('myschema', 'mytable', 'simple_geom', 4326,<br>
> >> 'MULTIPOLYGON', 2);<br>
> >> update myschema.mytable set simple_geom = ST_SimplifyPreserveTopology(**the_geom,<br>
> >> <tolerance>);<br>
> >><br>
> >> where <tolerance> is replaces by an appropriate value. This will depend on<br>
> >> the some trial and error. The above assume srid=4326 which is probably not a<br>
> >> good projection for doing simplification so you might want to project your<br>
> >> data into some other UTM or Mercator projection depending on your coverage<br>
> >> area and tolerance needs to be set with respect to those units.<br>
> >><br>
> >> -Steve W<br>
> >> ______________________________**_________________<br>
> >> postgis-users mailing list<br>
</div></div>> >> postgis-users@postgis.**<a href="http://refractions.net" target="_blank">refractions.net</a><<a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a>><br>

> >> <a href="http://postgis.refractions." target="_blank">http://postgis.refractions.</a>**net/mailman/listinfo/postgis-**users<<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a>><br>

<div><div></div><div class="h5">> >><br>
> ><br>
> > _______________________________________________<br>
> > postgis-users mailing list<br>
> > <a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
> > <a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
> ><br>
> ><br>
> ><br>
> > _______________________________________________<br>
> > postgis-users mailing list<br>
> > <a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
> > <a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
> ><br>
> ><br>
<br>
> _______________________________________________<br>
> postgis-users mailing list<br>
> <a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
> <a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
<br>
<br>
</div></div><font color="#888888">--<br>
<br>
  ()   Free GIS & Flash consultant/developer<br>
  /\   <a href="http://strk.keybit.net/services.html" target="_blank">http://strk.keybit.net/services.html</a><br>
</font></blockquote></div><br></div>