[postgis-users] Geometry vs Linestring

Nicolas Ribot nicolas.ribot at gmail.com
Wed May 7 07:11:54 PDT 2014


Hi,

You could also cast the call to st_makeline into a specific geometry type,
with some SRID (or 0 if data has no SRID) :

... ST_MakeLine(seeds.geom)::geometry(Linestring, <srid>)

Nicolas




On 7 May 2014 15:56, Stephen Woodbridge <woodbri at swoodbridge.com> wrote:

> Linestrings are geometry objects. If you want your table to have tighter
> constraints on it create the table first and use addgeometrycolumn() to set
> the geometry type and constraints then use
>
> insert into "l_506" (oid, geom) from SELECT ...
>
> CREATE TABLE AS does not know what the query will return as far as
> geometry types so it make a general "geometry" column.
>
> -Steve
>
>
> On 5/7/2014 9:38 AM, Pier Lorenzo Marasco wrote:
>
>> Hi all,
>>
>> I'm trying to make something very easy but I've a problem with results.
>> I've two tables and I need to make lines from the joins of these two.
>> I've try with this :
>>
>> CREATE TABLE "l_506" AS
>> SELECT elements.oid, ST_MakeLine(seeds.geom) AS geom
>> FROM elements
>>     JOIN seeds ON (elements.oid=seeds.oid)
>> WHERE elements.code='0506'
>> GROUP BY elements.oid;
>>
>> All the elements in seeds are linestring but what I achieve is a
>> geometry table. Ok.. I should alter the column type and everything goes
>> as I aspect but I would like to understand where I'm getting wrong.
>>
>> L.
>>
>> --
>> Pier Lorenzo Marasco
>>
>>
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at lists.osgeo.org
>> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>>
>>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20140507/c7dae3c5/attachment.html>


More information about the postgis-users mailing list