[postgis-users] Which postGIS functions to use?
Stephen Woodbridge
woodbri at swoodbridge.com
Sun Feb 15 08:15:40 PST 2009
I'm not sure if I understand you question correctly, but here is a
solution for my understanding.
So you have a network component that is partially overlapped by the quay
and you know the length along the network component where the overlap
starts or stops. You can extract the part of the network component that
overlap with ST_Intersection or ST_Difference as Regina suggests. You
can also do this using the linear referencing functions which might be
faster:
From start of netcomponent to your distance of intersection:
SELECT ST_line_substring(netcomponent.the_geom, 0.0,
dist_meters/ST_length_spheroid(netcomponent.the_geom,spheroid))
From your distance of intersection to the end of the netcomponent:
SELECT ST_line_substring(netcomponent.the_geom,
dist_meters/ST_length_spheroid(netcomponent.the_geom,spheroid), 1.0)
If you just want the point of intersection with the quay then this
should do it:
SELECT ST_locate_along_measure(netcomponent.the_geom,
dist_meters/ST_length_spheroid(netcomponent.the_geom,spheroid))
All these functions assume your geometry is in units degrees and you
will need to define an appropriate value for spheroid like:
SPHEROID[<NAME>,<SEMI-MAJOR AXIS>,<INVERSE FLATTENING>]
for example:
'SPHEROID["GRS_1980",6378137,298.257222101]'
-Steve
Paragon Corporation wrote:
> I don't quite understand your question.
>
> Are you trying to get the length of the intersection of the 2? So that part
> of the network component that falls within the quay?
>
> In that case it would be something of the form
>
> SELECT ST_Length(ST_Intersection(netcomponent.the_geom, quay.the_geom))
>
> Which assumes your netcomponent is defined as a LINESTRING (you can use
> ST_MakeLine
> http://postgis.refractions.net/documentation/manual-svn/ST_MakeLine.html
> if you have 2 points and no line)
>
> And quay is some sort of polygon.
>
> Hope that helps,
> Regina
>
> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net
> [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
> gt at fks.be
> Sent: Saturday, February 14, 2009 11:31 AM
> To: postgis-users at postgis.refractions.net
> Cc: guythomas at telenet.be
> Subject: [postgis-users] Which postGIS functions to use?
>
> I have a "network component" (= part of a waterway) defined by 2
> coordinates.
> I know how to calculate the length of that component.
>
> However, another component, let's say a quay, overlaps with the component. I
> know how far it overlaps (in meters) with the component from the beginning
> coordinate and I want to calculate the end coordinate of the quay (that
> should be on the network component).
>
> How do I do this?
>
> Thank you
>
>
> _______________________________________________
> 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
More information about the postgis-users
mailing list