<html><body><div><div><span>Sure, </span></div><br><div><code style="padding:0 4px;background-color:#F5F5F5;border-radius:4px;font-weight:500"><span>SELECT version();</span></code></div><br><blockquote style="margin:8px 0;padding:8px 16px 8px 6px;color:#8C8C8C;border-left:solid 2px #CCC"><div><span>"PostgreSQL 15.5, compiled by Visual C++ build 1914, 64-bit"</span></div></blockquote><br><div><code style="padding:0 4px;background-color:#F5F5F5;border-radius:4px;font-weight:500"><span>SELECT PostGIS_full_version();</span></code></div><br><blockquote style="margin:8px 0;padding:8px 16px 8px 6px;color:#8C8C8C;border-left:solid 2px #CCC"><div><span>"POSTGIS=""3.4.1 3.4.1"" [EXTENSION] PGSQL=""150"" GEOS=""3.12.1-CAPI-1.18.1"" PROJ=""8.2.1 NETWORK_ENABLED=OFF URL_ENDPOINT=</span><a target="_blank" rel="noopener noreferrer" href="https://cdn.proj.org">https://cdn.proj.org</a><span> USER_WRITABLE_DIRECTORY=C:\Windows\ServiceProfiles\NetworkService\AppData\Local/proj DATABASE_PATH=C:\Program Files\PostgreSQL\15\share\contrib\postgis-3.4\proj\proj.db"" LIBXML=""2.9.14"" LIBJSON=""0.12"" LIBPROTOBUF=""1.2.1"" WAGYU=""0.5.0 (Internal)"""</span></div></blockquote><br><br><br><div><span>Both edges and nodes tables where created by osm2pgrouting using the cars_config:</span></div><br><pre style="max-height:264px;margin:8px 0;padding:8px;background-color:#F5F5F5;border-radius:4px;font-weight:500;overflow:auto">CREATE TABLE IF NOT EXISTS public.ways
(
gid bigint NOT NULL DEFAULT nextval('ways_gid_seq'::regclass),
osm_id bigint,
tag_id integer,
length double precision,
length_m double precision,
name text COLLATE pg_catalog."default",
source bigint,
target bigint,
source_osm bigint,
target_osm bigint,
cost double precision,
reverse_cost double precision,
cost_s double precision,
reverse_cost_s double precision,
rule text COLLATE pg_catalog."default",
one_way integer,
oneway text COLLATE pg_catalog."default",
x1 double precision,
y1 double precision,
x2 double precision,
y2 double precision,
maxspeed_forward double precision,
maxspeed_backward double precision,
priority double precision DEFAULT 1,
the_geom geometry(LineString,4326),
CONSTRAINT ways_pkey PRIMARY KEY (gid),
CONSTRAINT ways_source_fkey FOREIGN KEY (source)
REFERENCES public.ways_vertices_pgr (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT ways_source_osm_fkey FOREIGN KEY (source_osm)
REFERENCES public.ways_vertices_pgr (osm_id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT ways_tag_id_fkey FOREIGN KEY (tag_id)
REFERENCES public.configuration (tag_id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT ways_target_fkey FOREIGN KEY (target)
REFERENCES public.ways_vertices_pgr (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT ways_target_osm_fkey FOREIGN KEY (target_osm)
REFERENCES public.ways_vertices_pgr (osm_id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
);</pre><br><pre style="max-height:264px;margin:8px 0;padding:8px;background-color:#F5F5F5;border-radius:4px;font-weight:500;overflow:auto">CREATE TABLE IF NOT EXISTS public.ways_vertices_pgr
(
id bigint NOT NULL DEFAULT nextval('ways_vertices_pgr_id_seq'::regclass),
osm_id bigint,
eout integer,
lon numeric(11,8),
lat numeric(11,8),
cnt integer,
chk integer,
ein integer,
the_geom geometry(Point,4326),
CONSTRAINT ways_vertices_pgr_pkey PRIMARY KEY (id),
CONSTRAINT ways_vertices_pgr_osm_id_key UNIQUE (osm_id)
);</pre><br><br><div><span>The query that I am running is the following:</span></div><br><pre style="max-height:264px;margin:8px 0;padding:8px;background-color:#F5F5F5;border-radius:4px;font-weight:500;overflow:auto">with result as (
SELECT * FROM pgr_drivingDistance(
' SELECT gid as id, -- Subquery to map our network table to the necessary fields
source,
target,
length_m as cost,
length_m as reverse_cost
FROM ways',
6317, -- origin
1000 -- distance
)
)
SELECT pgr_alphaShape((st_collect(v.the_geom))) as geom
FROM ways_vertices_pgr as v, result as r
WHERE r.node = v.id;</pre><br><div><span>Getting the geometry with st_astext, this is what I get. Looks like a Multipolygon, but is considered a GeometryCollection:</span></div><br><blockquote style="margin:8px 0;padding:8px 16px 8px 6px;color:#8C8C8C;border-left:solid 2px #CCC"><div><span>"GEOMETRYCOLLECTION(POLYGON((-9.15828 38.7401,-9.15801 38.7398,-9.15666 38.7395,-9.15649 38.7395,-9.15563 38.7398,-9.15485 38.7388,-9.15325 38.7391,-9.15307 38.7391,-9.15294 38.739,-9.15291 38.739,-9.15292 38.7386,-9.15447 38.7376,-9.15482 38.7359,-9.15409 38.7354,-9.15222 38.7356,-9.15168 38.7349,-9.15156 38.7347,-9.1516 38.7347,-9.15196 38.7336,-9.15183 38.7332,-9.15186 38.7331,-9.15219 38.7322,-9.15351 38.7323,-9.15504 38.7321,-9.15497 38.7323,-9.1551 38.7333,-9.15492 38.7339,-9.15512 38.7353,-9.15689 38.7353,-9.15721 38.7347,-9.15779 38.7345,-9.15826 38.7346,-9.15844 38.7344,-9.1587 38.7343,-9.15961 38.7331,-9.15955 38.7328,-9.15956 38.7323,-9.15936 38.7316,-9.1595 38.7316,-9.15992 38.7313,-9.16141 38.7304,-9.16058 38.7283,-9.15994 38.7285,-9.15986 38.7284,-9.16 38.7282,-9.16006 38.7281,-9.16038 38.7279,-9.16055 38.7278,-9.16064 38.7278,-9.16165 38.7277,-9.16233 38.7275,-9.16342 38.7273,-9.16346 38.7274,-9.16398 38.7289,-9.1644 38.73,-9.16423 38.7304,-9.16536 38.7321,-9.16536 38.7332,-9.16555 38.7335,-9.16565 38.7336,-9.16598 38.734,-9.1663 38.7349,-9.16646 38.7351,-9.16567 38.7354,-9.16419 38.7357,-9.16471 38.7375,-9.1639 38.7382,-9.16343 38.7371,-9.16246 38.7368,-9.16235 38.7368,-9.1618 38.7366,-9.16104 38.7364,-9.15963 38.738,-9.15963 38.7382,-9.15911 38.7384,-9.1586 38.74,-9.15866 38.7402,-9.15828 38.7401),(-9.15493 38.7355,-9.15488 38.7353,-9.15512 38.7353,-9.15493 38.7355),(-9.16211 38.7321,-9.16213 38.7319,-9.16224 38.732,-9.16211 38.7321),(-9.15995 38.7363,-9.16018 38.7362,-9.16009 38.7364,-9.15995 38.7363),(-9.15693 38.7376,-9.1568 38.7375,-9.15726 38.7373,-9.15693 38.7376),(-9.1626 38.732,-9.16244 38.7319,-9.16255 38.7318,-9.1626 38.732),(-9.16366 38.7368,-9.16362 38.737,-9.16349 38.737,-9.16366 38.7368)),POLYGON((-9.15488 38.7353,-9.15512 38.7353,-9.15493 38.7355,-9.15488 38.7353)),POLYGON((-9.1587 38.7343,-9.15956 38.7329,-9.15955 38.7328,-9.15961 38.7331,-9.1587 38.7343)),POLYGON((-9.15826 38.7346,-9.15779 38.7345,-9.15844 38.7344,-9.15826 38.7346)),POLYGON((-9.16211 38.7321,-9.16213 38.7319,-9.16224 38.732,-9.16211 38.7321)),POLYGON((-9.16018 38.7362,-9.16009 38.7364,-9.15995 38.7363,-9.16018 38.7362)),POLYGON((-9.1568 38.7375,-9.15726 38.7373,-9.15693 38.7376,-9.1568 38.7375)),POLYGON((-9.16255 38.7318,-9.1626 38.732,-9.16244 38.7319,-9.16255 38.7318)),POLYGON((-9.16362 38.737,-9.16349 38.737,-9.16366 38.7368,-9.16362 38.737)))"</span></div></blockquote><br><div><span>Hope it helps to understand what may be wrong.</span></div><br><div><span>Alexandre Neto</span></div><br><br><br><div><span>I am running the following query</span></div></div><br><div class="shortwave-signature"><div>
Sent with <a href="https://www.shortwave.com?utm_medium=email&utm_content=signature&utm_source=c2VuaG9yLm5ldG9AZ21haWwuY29t" target="_blank" rel="noopener" style="color:#4C8AFF">Shortwave</a>
</div></div><br><div><div>On Mon Feb 5, 2024, 04:08 PM GMT, <a href="mailto:lr@pcorp.us">Regina Obe</a> wrote:<br></div><blockquote style="margin:0 0 0 4pt;padding-left:4pt;border-left:1px solid #CCC"><div lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word"><style>.MsoNormal{margin:0}</style><div class="WordSection1"><p class="MsoNormal">Can you give us an example you are getting this for? It should be returning a polygon.</p><p class="MsoNormal"> </p><div style="border:none;border-left:solid blue 1.5pt;padding:0 0 0 4.0pt"><div><div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0 0 0"><p class="MsoNormal"><b>From:</b> Alexandre Neto <senhor.neto@gmail.com> <br><b>Sent:</b> Monday, February 5, 2024 7:14 AM<br><b>To:</b> PostGIS Users Discussion <postgis-users@lists.osgeo.org><br><b>Subject:</b> pgr_alphashape is returning a geometry collection?</p></div></div><p class="MsoNormal"> </p><div><div><p class="MsoNormal">I am trying to use pgr_alphashape to convert a set of nodes into a polygon. The documentation description says:</p></div><p class="MsoNormal"> </p><div><p class="MsoNormal">Returns the polygon part of an alpha shape.</p></div><p class="MsoNormal"> </p><div><p class="MsoNormal">But instead I am getting a geometry_collection instead. I can solve it with st_CollectionExtract, but I m wondering if this is the expected behaviour.</p></div><p class="MsoNormal"> </p><div><p class="MsoNormal">Alexandre Neto</p></div></div><p class="MsoNormal"> </p><div><div><p class="MsoNormal">Sent with <a href="https://www.shortwave.com?utm_medium=email&utm_content=signature&utm_source=c2VuaG9yLm5ldG9AZ21haWwuY29t" target="_blank" rel="noopener noreferrer"><span style="color:#4C8AFF">Shortwave</span></a> </p></div></div></div></div></div></blockquote></div></body></html>