[postgis-users] st_offsetcurve

Simon Greener simon at spatialdbadvisor.com
Wed May 9 20:40:32 PDT 2012


Folks,

Sorry about that. The file:

http://www.spatialdbadvisor.com/file_download/55/PostGIS_Parallel.sql

Did not contain all the required types and functions. One needed also to access the types and functions for my ST_GetVector function.

I have now included all the required types and related functions in the above script and replaced it on my site.

I have changed a bit in the code as it didn't handle some situations as I expected. Hopefully my test cases give good coverage.

My tests, conducted on PostgreSQL 9.1 and PostGIS 2.0 on Windows 7 64 Bit all work as this example shows:

With geometries As (
           select ST_GeomFromText('LINESTRING(1 1,1 10)') as geom,
                  10.0 as offset,2 as roundFactor,0 as curved
union all select ST_GeomFromText('LINESTRING(0 0,1 1,1 2)') as geom,
                   0.5 as offset,2 as roundFactor,
                  generate_series(0,1,1) as curved
union all select ST_GeomFromText('LINESTRING(0.0 0.0, 45.0 45.0, 90.0 0.0, 135.0 45.0, 180.0 0.0, 180.0 -45.0, 45.0 -45.0, 0.0 0.0)') as geom,
                  10.0 as offset,2 as roundFactor,
                  generate_series(0,1,1) as curved
union all select ST_GeomFromText('MULTILINESTRING((0 0,1 1,1 2),(2 3,3 2,5 4))') as geom,
                   0.5 as offsetRight,2 as roundFactor,
                  generate_series(0,1,1) as curved
)
select ST_AsText(g.geom) as origGeom, g.offset,g.curved,
        ST_AsText(ST_Parallel(g.geom,g.offset,g.roundFactor,g.curved)) as geomWKTLeft,
        ST_AsText(ST_Parallel(g.geom,0.0-g.offset,g.roundFactor,g.curved)) as geomWKTRight
   from geometries as g;

"LINESTRING(1 1,1 10)";10.0;0;"LINESTRING(11 1,11 10)";"LINESTRING(-9 1,-9 10)"
"LINESTRING(0 0,1 1,1 2)";0.5;0;"LINESTRING(0.35 -0.35,1.5 0.79,1.5 2)";"LINESTRING(-0.35 0.35,0.5 1.21,0.5 2)"
"LINESTRING(0 0,1 1,1 2)";0.5;1;"COMPOUNDCURVE((0.35 -0.35,1.35 0.65),CIRCULARSTRING(1.35 0.65,1.46 0.81,1.5 1),(1.5 1,1.5 2))";"LINESTRING(-0.35 0.35,0.5 1.21,0.5 2)"
"LINESTRING(0 0,45 45,90 0,135 45,180 0,180 -45,45 -45,0 0)";10.0;0;"LINESTRING(7.07 -7.07,45 30.86,90 -14.14,135 30.86,170 -4.14,170 -35,49.14 -35,7.07 7.07)";"LINESTRING(-7.07 7.07,45 59.14,90 14.14,135 59.14,190 4.14,190 -55,40.86 -55,-7.07 -7.07)"
"LINESTRING(0 0,45 45,90 0,135 45,180 0,180 -45,45 -45,0 0)";10.0;1;"COMPOUNDCURVE((7.07 -7.07,45 30.86,82.93 -7.07),CIRCULARSTRING(82.93 -7.07,90 -10,97.07 -7.07),(97.07 -7.07,134.71 31.15,170 -4.14,170 -35,49.14 -35,7.07 7.07))";"COMPOUNDCURVE((-7.07 7.07,37.93 52.07),CIRCULARSTRING(37.93 52.07,45 55,52.07 52.07),(52.07 52.07,89.71 13.85,127.93 52.07),CIRCULARSTRING(127.93 52.07,135 55,142.07 52.07),(142.07 52.07,187.07 7.07),CIRCULARSTRING(187.07 7.07,189.16 4.01,190 0),(190 0,190 -45),CIRCULARSTRING(190 -45,187.13 -52.01,180 -55),(180 -55,45 -55),CIRCULARSTRING(45 -55,41.27 -54.28,37.93 -52.07),(37.93 -52.07,-7.07 -7.07))"
"MULTILINESTRING((0 0,1 1,1 2),(2 3,3 2,5 4))";0.5;0;"MULTILINESTRING((1.65 2.65,3 1.29,5.35 3.65))";"MULTILINESTRING((2.35 3.35,3 2.71,4.65 4.35))"
"MULTILINESTRING((0 0,1 1,1 2),(2 3,3 2,5 4))";0.5;1;"MULTICURVE((1.65 2.65,2.65 1.65),CIRCULARSTRING(2.65 1.65,3 1.5,3.35 1.65),(3.35 1.65,5.35 3.65))";"MULTILINESTRING((2.35 3.35,3 2.71,4.65 4.35))"

Sorry for any inconvenience.

The file is available for download via the link above.

regards
Simon


On Wed, 09 May 2012 23:27:04 +1000, Pedro Costa <pedrocostaarma at sapo.pt> wrote:

> No problem Hugues.
>
> Give me the same error:
>
> ERROR:  function st_parallel(geometry, numeric, numeric, integer) does
> not exist
> LINE 1: select ST_Parallel(the_geom, 3.0, 0.0, 0) as test from tests
>
>
>
> Em 09-05-2012 13:48, Francois Hugues escreveu:
>> Sorry, I read your message too fast and forgot the PS.
>>
>> Maybe you could try something like :
>> select ST_Parallel(the_geom, 3.0, 0.0, 0) as test from tests
>>
>> Hugues.
>>
>>
>>
>> -----Message d'origine-----
>> De : postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-bounces at postgis.refractions.net] De la part de Pedro Costa
>> Envoyé : mercredi 9 mai 2012 13:06
>> À : PostGIS Users Discussion
>> Objet : Re: [postgis-users] st_offsetcurve
>>
>> Em 09-05-2012 11:28, Pedro Costa escreveu:
>>> PS: I´m already install the function by your file
>> I'm already do that...
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>


-- 
Holder of "2011 Oracle Spatial Excellence Award for Education and Research."
SpatialDB Advice and Design, Solutions Architecture and Programming,
Oracle Database 10g Administrator Certified Associate; Oracle Database 10g SQL Certified Professional
Oracle Spatial, SQL Server, PostGIS, MySQL, ArcSDE, Manifold GIS, FME, Radius Topology and Studio Specialist.
39 Cliff View Drive, Allens Rivulet, 7150, Tasmania, Australia.
Website: www.spatialdbadvisor.com
   Email: simon at spatialdbadvisor.com
   Voice: +61 362 396397
Mobile: +61 418 396391
Skype: sggreener
Longitude: 147.20515 (147° 12' 18" E)
Latitude: -43.01530 (43° 00' 55" S)
GeoHash: r22em9r98wg
NAC:W80CK 7SWP3



More information about the postgis-users mailing list