[postgis-users] Shp2pgsql - ability to generate a linestring table

Paul Ramsey pramsey at refractions.net
Sat Sep 16 02:44:57 PDT 2006


The shape file format does not distinguish between LINESTRING and  
MULTILINESTRING.   Non-aggregate linestrings are simply encoded as 1- 
element multilinestrings.  In order for shp2pgsql to correctly figure  
out the right type, it would have to scan the whole shape file  
initially and check the number of elements in each feature to ensure  
none have > 1.

You can turn your shapes into ordinary linestrings post-process  
inside PostGIS if you like, by using the GeometryN() function.  Make  
sure you also test beforehand that none of your shapes is an  
aggregate by using "select count(*) from mytable where numgeometries 
(the_geom) > 1"

Paul

On 15-Sep-06, at 12:15 PM, Stewart Nimmo wrote:

>
> When running "shp2pgsql" on a polyline shape file,  the resulting  
> table is
> always a geometry type "multilinestring".  I am expecting and  
> require a
> geometry type of  "linestring" .
>
> Is "multilinestring" the default geometry type for polyline shape  
> files
> being converted with shp2pgsql.
>
> Regards
>
> Stewart
>
> <winmail.dat>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users




More information about the postgis-users mailing list