[postgis-users] Point in Polygon Problem
pcreso at pcreso.com
pcreso at pcreso.com
Fri Oct 22 13:02:21 PDT 2010
Paul
I suggest you chaeck the XY coords in your data, it looks like you have mislabeled lat & lon, your "lat" values are > 90 & <180.
If you have loaded these into Postgis with the coords reversed, then they will not be in the correct location, which could be why ST_contains fails
Brent Wood
--- On Sat, 10/23/10, Marc Jansen <jansen at terrestris.de> wrote:
From: Marc Jansen <jansen at terrestris.de>
Subject: Re: [postgis-users] Point in Polygon Problem
To: postgis-users at postgis.refractions.net
Date: Saturday, October 23, 2010, 8:50 AM
Hi Paul,
AFAICT you are using ST_Cointains correctly, and MultiPolygons
shouldn't be an issue. I assume that your geometries have the same
SRID, otherwise PostGIS would complain.
Can you post a full example (including the WKT of both geometries)
where you get false but expect true for ST_Contains(geomA, geomB)?
Something like:
SELECT ST_Contains('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))',
'POINT(5 5)') or
SELECT ST_Contains('MULTIPOLYGON(((0 0, 0 10, 10 10, 10 0, 0 0)))',
'POINT(5 5)')
so everyone can easily test this.
Both yield true for my -- ancient ;-) -- POSTGIS="1.3.5"
GEOS="3.0.3-CAPI-1.4.2" PROJ="Rel. 4.4.9, 29 Oct 2004" USE_STATS
Regards,
Marc
Am 22.10.2010 08:37, schrieb Marcos Paul:
Hi Folks,
I am trying to solve a simple problem: the point in polygon. First
of all, I have a CSV file with the polygons in list similar to the
WKT Format, that is something like:
BUILT_UP_AREA_ID
VERTEX_SEQ
LATITUDE
LONGITUDE
1081
0
152.6657
-25.5206
1081
1
152.6662
-25.5211
1081
2
152.6666
-25.5216
1081
3
152.6673
-25.5224
1081
4
152.668
-25.523
1081
5
152.6694
-25.5247
1081
6
152.67
-25.5255
1081
7
152.6707
-25.5263
1081
8
152.6734
-25.5291
1081
9
152.6741
-25.5295
1081
10
152.6745
-25.5299
1081
11
152.675
-25.5301
1081
12
152.676
-25.5313
1081
13
152.6762
-25.5317
1081
14
152.6764
-25.5321
1081
15
152.6764
-25.5333
1081
16
152.6766
-25.534
1081
17
152.6766
-25.5341
1081
18
152.6771
-25.5341
1081
19
152.6774
-25.534
1081
20
152.6788
-25.5354
1081
21
152.6797
-25.5361
1081
22
152.6788
-25.5368
From there I want to export that to my postgis data base, I solved
that converting the CSV to a Shape file and then applying the
shp2psql gui.
When I am trying to check if a particular point is inside my table
I am just applying the following command:
select ST_ASTEXT(the_geom) as multipolygons FROM Table_Polygons
WHERE ST_Contains(Table_Polygons.the_geom,
ST_GeometryFromText('POINT(X,Y)'));
So after that, I am getting that the point X,Y is not inside one
of the polygons of my file, when I am completely sure that this
point is actually inside a polygon.
What I am doing wrong? Does the fact that I am using
Multipolygons affect at all?
Thank you for your help,
Paul
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
-----Inline Attachment Follows-----
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20101022/debfc3fe/attachment.html>
More information about the postgis-users
mailing list