Hello,
I have been using PostGis and Django Geos for a long time now, however
today they both failed me. This prompted me to search and find sympy,
so here I am.
I am trying to find the perpendicular distance from a Line to a Point.
PostGis and Django Geos will only let me calculate the distance
>>> help(Line.perpendicular_segment)
Help on method perpendicular_segment in module sympy.geometry.line:
perpendicular_segment(self, p) unbound sympy.geometry.line.Line
method
Returns a new Segment which connects p to a point on this linear
entity and is al
Chris thank you for your quick reply.
The original example I posted used test data, below is as far as I
have gotten with real numbers.
from sympy.geometry import *
# Define a Line given two points p1 and p2.
p1 = Point(-694310.42867240659, 7051910.5392115889)
p2 = Point(-694286.161023414, 705191
I think we should not warn about floats; we should just convert them in
routines such as this. Until then, try change your floats to Rational, e.g.
>>> def rat(d):
... return S(str(d), rational=True)
...
>>> p1 = Point(rat(-694310.42867240659), rat(7051910.5392115889))
>>> p2
On Tue, Jun 21, 2011 at 9:57 AM, cathal coffey wrote:
> Chris thank you for your quick reply.
> The original example I posted used test data, below is as far as I
> have gotten with real numbers.
>
> from sympy.geometry import *
>
> # Define a Line given two points p1 and p2.
> p1 = Point(-694310.
Chris,
I got it to work, solution is below. Thanks for all your help... sympy rocks!!!.
Cathal
import sympy
from sympy import Rational
# Convert to Rational
def rat(d):
return Rational(str(d))
# Calculate the perpendicular distance from the point (lat, lon) to
the line defined by the point
Chris,
when I execute your code I get the error: TypeError: sympify() got an
unexpected keyword argument 'rational'.
I installed sympy using apt-get install python-sympy and synaptic
reports 0.6.7-1.1 as the installed version.
When I execute ?S I don't see any options for rational.
Call def: S(a
Aaron,
sorry its not actually a Google thing.
http://en.wikipedia.org/wiki/Mercator_projection
Cathal
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To post to this group, send email to sympy@googlegroups.com.
To unsubscribe from this group, send e
Sometimes you have two sympy installations, e.g. one in site-packages and
one somewhere else. Figuring out which one is getting used is the trick. I
haven't really spent the time to figure out how to get my IDE to use the one
that is in my git directory. I just know what I have to do to use the git
I think he was not using the git version at all. To get those features Chris
mentioned, you need to use the development version, or else use the 0.7.0
version that will be coming out in a few days.
Aaron Meurer
On Jun 22, 2011, at 5:57 AM, Chris Smith wrote:
> Sometimes you have two sympy ins
10 matches
Mail list logo