<div dir="ltr"><div><div><div><div><div>Hm,<br><br></div>you have a table with polygons.<br></div>Obviously some of the polygons are not valid.<br></div><div>So when you correct some of the polygon, they are transformed to line (my guess : some of the polygons are wihtout surface, for instance POLYGON((0 0 , 1 1 , 0 0 )) ).<br>
</div><div>Now when trying to insert line into polygon column, postgres complains. <br><br><br></div><div>You can do 2 things :<br></div><div>_solve the postgres error, this imply to be sure to update with polygons<br></div>
<div>_solve the geometry problem, this imply to look a bit into your data to understand why you have invalid polygon in the first place ..;<br><br> <br></div><div><br></div>The query I gave you is going to show the invalid polygon and why they are invalid (solving 2.).<br>
</div>If you just don't care, you can update only when the result is a polygon.(this querry is suboptimal)<br><br>UPDATE ft_potencial SETthe_geom=ST_MakeValid(the_geom)<br><div id=":2h6" class="">WHERE GeometryType(ST_MakeValid(the_geom) ) ILIKE '%POLYGON%';</div>
<br></div>Cheers,<br>Remi-C<br><div><div><div><br><br></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-05-16 23:58 GMT+02:00 <span dir="ltr"><<a href="mailto:islanis@infomed.sld.cu" target="_blank">islanis@infomed.sld.cu</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">"Rémi Cura" <<a href="mailto:remi.cura@gmail.com" target="_blank">remi.cura@gmail.com</a>> escribió:<br>
<br>
Remi i dont understand what do you mean here,<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">
You can try to analyze a bit to understand better<br>
(for the following I consider your table doesn't contains too much data)<br>
<br>
with the_data AS (<br>
SELECT the_geom, ST_ISValid(the_geom) AS is_valid,<br>
ST_IsValidReason(the_geom)<br>
FROM ft_potencial<br>
)<br>
SELECT *, ST_AsText(ST_MakeValid(the_<u></u>geom)) AS corrected_geom,<br>
ST_AsText(the_geom) AS original_geometry, detail.*<br></div>
FROM the_data, *ST_IsValidDetail*(the_geom) AS detail<div class=""><br>
WHERE is_valid = false<br>
AND GeometryType(the_geom) ILIKE '%POLYGON%'<br>
<br>
My guess : you have an invalid no-area polygon, so the makevalid function<br>
transform it into a line<br>
</div></blockquote>
<br>
ok, but like i say above, i dont understan, please be more specific, please, but thanks<div class="HOEnZb"><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Cheers,<br>
Rémi-C<br>
<br>
<br>
2014-05-16 18:14 GMT+02:00 <<a href="mailto:islanis@infomed.sld.cu" target="_blank">islanis@infomed.sld.cu</a>>:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
"Ivan Santiago" <<a href="mailto:isantiago@ogp.pr.gov" target="_blank">isantiago@ogp.pr.gov</a>> escribió:<br>
<br>
<br>
Hello:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Run<br>
SELECT PostGIS_full_version();<br>
TO know if your installation has GEOS 3.3.0 or above.<br>
<br>
</blockquote>
I get this<br>
<br>
<br>
"POSTGIS="2.0.0 r9605" GEOS="3.3.3-CAPI-1.7.4" PROJ="Rel. 4.8.0, 6 March<br>
2012" GDAL="GDAL 1.9.0, released 2011/12/29" LIBXML="2.7.8"<br>
LIBJSON="UNKNOWN" TOPOLOGY RASTER"<br>
<br>
<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
---------------------------<br>
Iván Santiago<br>
GIS Specialist<br>
Information Technologies<br>
Office of Management and Budget<br>
787.725.9420 x 2378<br>
Calle Cruz 254<br>
PO Box 9023228<br>
San Juan, PR 00902-3228<br>
<a href="http://gis.pr.gov" target="_blank">http://gis.pr.gov</a><br>
<br>
<br>
-----Original Message-----<br>
From: <a href="mailto:postgis-users-bounces@lists.osgeo.org" target="_blank">postgis-users-bounces@lists.<u></u>osgeo.org</a> [mailto:<br>
<a href="mailto:postgis-users-bounces@lists.osgeo.org" target="_blank">postgis-users-bounces@lists.<u></u>osgeo.org</a>] On Behalf Of<br>
<a href="mailto:islanis@infomed.sld.cu" target="_blank">islanis@infomed.sld.cu</a><br>
Sent: Friday, May 16, 2014 11:24 AM<br>
To: <a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br>
Subject: [postgis-users] problem with st_makevalid and (LineString)<br>
<br>
Hello people, i got a problem where i have no idea what can i do.<br>
<br>
I have this table<br>
<br>
CREATE TABLE ft_potencial<br>
(<br>
id_dw_ft_potencial integer NOT NULL,<br>
id_dw_tipo integer NOT NULL,<br>
id_dw_mes integer NOT NULL,<br>
id_dw_municipio integer NOT NULL,<br>
id_dw_date integer NOT NULL,<br>
potencial real NOT NULL,<br>
area real NOT NULL,<br>
the_geom geometry(Polygon,4326),<br>
CONSTRAINT ft_potencial_pkey PRIMARY KEY (id_dw_ft_potencial,<br>
id_dw_tipo, id_dw_mes, id_dw_municipio, id_dw_date)<br>
)<br>
WITH (<br>
OIDS=FALSE<br>
);<br>
<br>
and i want to clean the errors that it has using the function<br>
ST_MakeValid in this way<br>
<br>
update ft_potencial set the_geom=ST_MakeValid(the_<u></u>geom);<br>
<br>
but it always return this error<br>
<br>
ERROR: Geometry type (LineString) does not match column type (Polygon)<br>
<br>
********** Error **********<br>
<br>
ERROR: Geometry type (LineString) does not match column type (Polygon)<br>
Estado SQL:22023<br>
<br>
<br>
what can i do to fix or clean the geometry without problems.<br>
<br>
please help.<br>
thanks<br>
<br>
------------------------------<u></u>------------------------------<u></u>----<br>
This message was sent using IMP, the Internet Messaging Program.<br>
<br>
<br>
--<br>
<br>
Este mensaje le ha llegado mediante el servicio de correo electronico que<br>
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema<br>
Nacional de Salud. La persona que envia este correo asume el compromiso de<br>
usar el servicio a tales fines y cumplir con las regulaciones establecidas<br>
<br>
Infomed: <a href="http://www.sld.cu/" target="_blank">http://www.sld.cu/</a><br>
<br>
______________________________<u></u>_________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-<u></u>bin/mailman/listinfo/postgis-<u></u>users</a><br>
______________________________<u></u>_________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-<u></u>bin/mailman/listinfo/postgis-<u></u>users</a><br>
<br>
<br>
</blockquote>
<br>
<br>
------------------------------<u></u>------------------------------<u></u>----<br>
This message was sent using IMP, the Internet Messaging Program.<br>
<br>
<br>
<br>
--<br>
<br>
Este mensaje le ha llegado mediante el servicio de correo electronico que<br>
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema<br>
Nacional de Salud. La persona que envia este correo asume el compromiso de<br>
usar el servicio a tales fines y cumplir con las regulaciones establecidas<br>
<br>
Infomed: <a href="http://www.sld.cu/" target="_blank">http://www.sld.cu/</a><br>
<br>
______________________________<u></u>_________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-<u></u>bin/mailman/listinfo/postgis-<u></u>users</a><br>
<br>
</blockquote>
<br>
</blockquote>
<br>
<br>
<br>
------------------------------<u></u>------------------------------<u></u>----<br>
This message was sent using IMP, the Internet Messaging Program.<br>
<br>
<br>
<br>
--<br>
<br>
Este mensaje le ha llegado mediante el servicio de correo electronico que ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema Nacional de Salud. La persona que envia este correo asume el compromiso de usar el servicio a tales fines y cumplir con las regulaciones establecidas<br>
<br>
Infomed: <a href="http://www.sld.cu/" target="_blank">http://www.sld.cu/</a><br>
<br>
______________________________<u></u>_________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-<u></u>bin/mailman/listinfo/postgis-<u></u>users</a></div></div></blockquote></div><br></div>