I have one big polygon called huc and a multilinestring called streams, I am running an intersection on between the two layers to clip the streams to the huc.
here is what I have so far
drop table if exists base_layers.streams_huc_clip;
create table base_layers.streams_huc_clip as
select s.*,case
when st_within(s.shape,huc.shape) then s.shape
when st_intersects(s.shape,huc.shape) then st_intersection(s.shape,huc.shape)
end as geom2
from postgres.streams s join base_layers.huc_hl_dissolve huc on st_intersects(s.shape,huc.shape);
--pretty straightforward query in postgis, this query returns with no errors and correctly gets displayed in QGIS.
However when I try and bring it into ArcGIS I get this error and it does not draw
One or more layers failed to draw:
lucz_2017.base_layers.streams_huc_clip: The number of points is less than required for feature
so here are the following steps I tried after to do after it would not show up in ArcGIS to no avail.
dropped the original geometry so I just had one geometry column, renamed the new geom to shape
alter table base_layers.streams_huc_clip drop column shape;
alter table base_layers.streams_huc_clip rename geom2 to shape;
dropped the objectid and added new primary key, changed owners,
alter table base_layers.streams_huc_clip drop column objectid;
ALTER TABLE base_layers.streams_huc_clip ADD COLUMN id SERIAL PRIMARY KEY;
alter table base_layers.streams_huc_clip owner to base_layers;
created an index and tried updating the srid. none of this worked!
ALTER TABLE base_layers.streams_huc_clip ALTER COLUMN shape type geometry(multilinestring, 3424) using st_multi(shape);
CREATE INDEX streams ON base_layers.streams_huc_clip USING GIST (shape);
also ran this query
SELECT * FROM public.geometry_columns ORDER BY type
which returned
I am thinking about running an st_dump on the geometry to turn it into a linestring, I will take any suggestions on why this layer is not displaying and what I can do to make it work
I ran an st_dump and turned the geometry into a linestring but I still got the same arcmap error
drop table if exists base_layers.streams_huc_clip;
create table base_layers.streams_huc_clip as
select (st_dump(geom)).geom as geom2,t.* from(
select s.*,case
when st_within(s.shape,huc.shape) then s.shape
when st_intersects(s.shape,huc.shape) then st_intersection(s.shape,huc.shape)
end as geom
from postgres.streams s join base_layers.huc_hl_dissolve huc on st_intersects(s.shape,huc.shape))t;
ST_MakeValid() did not help either
I make edits to these tables outside the ESRI stack.
ST_Snap_To_Grid
to reduce the precision - getting the threshold right will take some trial an error, but shouldn't take too long. Based on @PolyGeo's link start with 0.0001.