|
View:
New views
12 Messages
—
Rating Filter:
Alert me
|
|
|
Select Point or PolyGon Polyline in Boxhi all
i have question to postgis i have table Pointdemo I want select all point in my Box("Rectangle") on PostGis my box is corrdinate ex: full extend is:Box(110638 2587481, 903350 1972446) ---> xmin ymin, xmax ymax i want select point in Box(295149 2315499, 465992 2163790) ---> xmin ymin, xmax ymax How will i do that ????? |
|
|
RE: Select Point or PolyGon Polyline in BoxAssuming your box is in the same srid as your points. It would be
something like SELECT * FROM pointdemo WHERE the_point && setsrid('BOX(295149 2315499, 465992 2163790)'::box2d, -1) Note - above I am assuming your point geometry is called the_point and your SRID is -1 If the srid of your point geometry is not -1 then change -1 to what it should be. -----Original Message----- From: postgis-users-bounces@... [mailto:postgis-users-bounces@...] On Behalf Of anhtin Sent: Tuesday, April 10, 2007 6:18 AM To: postgis-users@... Subject: [postgis-users] Select Point or PolyGon Polyline in Box hi all i have question to postgis i have table Pointdemo I want select all point in my Box("Rectangle") on PostGis my box is corrdinate ex: full extend is:Box(110638 2587481, 903350 1972446) ---> xmin ymin, xmax ymax i want select point in Box(295149 2315499, 465992 2163790) ---> xmin ymin, xmax ymax How will i do that ????? -- View this message in context: http://www.nabble.com/Select-Point-or-PolyGon-Polyline-in-Box-tf3552167. html#a9916986 Sent from the PostGIS - User mailing list archive at Nabble.com. _______________________________________________ postgis-users mailing list postgis-users@... http://postgis.refractions.net/mailman/listinfo/postgis-users ----------------------------------------- The substance of this message, including any attachments, may be confidential, legally privileged and/or exempt from disclosure pursuant to Massachusetts law. It is intended solely for the addressee. If you received this in error, please contact the sender and delete the material from any computer. _______________________________________________ postgis-users mailing list postgis-users@... http://postgis.refractions.net/mailman/listinfo/postgis-users |
|
|
RE: Select Point or PolyGon Polyline in Boxthanks
How is Select if it is Point ?????
|
|
|
RE: RE: Select Point or PolyGon Polyline in BoxDon't quite get what you are asking? Are you trying to compare if 2
points are the same or if a point is within x distance of another point? or something entirely different? If you wanted to select all points within x distance of your reference point , then it would be (again replace -1 with the correct SRID and distance is always measured in the units of your spatial reference system) SELECT * FROM pointdemo WHERE the_point && Expand(GeomFromText('POINT(295149 2315499)', -1), 10) AND distance(the_point,GeomFromText('POINT(295149 2315499)', -1)) <= 10 If you wanted to know if 2 points are the same then it would be SELECT * FROM pointdemo WHERE the_point ~= GeomFromText('POINT(295149 2315499)', -1) -----Original Message----- From: postgis-users-bounces@... [mailto:postgis-users-bounces@...] On Behalf Of anhtin Sent: Wednesday, April 11, 2007 12:32 AM To: postgis-users@... Subject: [postgis-users] RE: Select Point or PolyGon Polyline in Box thanks How is Select if it is Point ????? Obe, Regina DND\MIS wrote: > > Assuming your box is in the same srid as your points. It would be > something like > > SELECT * > FROM pointdemo > WHERE the_point && setsrid('BOX(295149 2315499, 465992 > 2163790)'::box2d, -1) > > > Note - above I am assuming your point geometry is called the_point and > your SRID is -1 > If the srid of your point geometry is not -1 then change -1 to what > should be. > > > -----Original Message----- > From: postgis-users-bounces@... > [mailto:postgis-users-bounces@...] On Behalf Of > anhtin > Sent: Tuesday, April 10, 2007 6:18 AM > To: postgis-users@... > Subject: [postgis-users] Select Point or PolyGon Polyline in Box > > > hi all > i have question to postgis > i have table Pointdemo > I want select all point in my Box("Rectangle") on PostGis > my box is corrdinate > ex: full extend is:Box(110638 2587481, 903350 1972446) ---> xmin ymin, > xmax > ymax > i want select point in Box(295149 2315499, 465992 2163790) ---> xmin > ymin, > xmax ymax > How will i do that ????? > > > -- > View this message in context: > > html#a9916986 > Sent from the PostGIS - User mailing list archive at Nabble.com. > > _______________________________________________ > postgis-users mailing list > postgis-users@... > http://postgis.refractions.net/mailman/listinfo/postgis-users > > ----------------------------------------- > The substance of this message, including any attachments, may be > confidential, legally privileged and/or exempt from disclosure > pursuant to Massachusetts law. It is intended > solely for the addressee. If you received this in error, please > contact the sender and delete the material from any computer. > > _______________________________________________ > postgis-users mailing list > postgis-users@... > http://postgis.refractions.net/mailman/listinfo/postgis-users > > -- View this message in context: http://www.nabble.com/Select-Point-or-PolyGon-Polyline-in-Box-tf3552167. html#a9933066 Sent from the PostGIS - User mailing list archive at Nabble.com. _______________________________________________ postgis-users mailing list postgis-users@... http://postgis.refractions.net/mailman/listinfo/postgis-users _______________________________________________ postgis-users mailing list postgis-users@... http://postgis.refractions.net/mailman/listinfo/postgis-users |
|
|
RE: RE: Select Point or PolyGon Polyline in BoxThanks very much so support for me
if i have that point i want select this point be in Polygon ex: i have table Polygon is province. i want select point(295054 849444) be in Polygon ???? and or be in polyline can u show 2 way with polygon and polyline thanks befor :)
|
|
|
RE: RE: RE: Select Point or PolyGon Polyline in BoxTo find the polygon where a point resides - there are actually several
ways of doing this and I'm not sure which one is fastest or the preferred. There is (in these I am assuming the_poly is the polygon geometry) I usually just do the first because it is pretty all purpose for most of the things I do and you don't have to think about the order of arguments in distance like you have to in within) SELECT * FROM polygon WHERE GeomFromText('POINT(295149 2315499)', -1) && the_poly AND distance(the_poly, GeomFromText('POINT(295149 2315499)', -1)) = 0 There is also SELECT * FROM polygon WHERE GeomFromText('POINT(295149 2315499)', -1) && the_poly AND Within(GeomFromText('POINT(295149 2315499)', -1),the_poly) For Poly Line's it's a little trickier because there is no such thing in postgis lingo for Polyline. I think the closest is Linestring or MultiLineString. So if you have a linestring or multilinestring that forms a polyline, I'm not sure if you would have to convert it to a polygon using buildarea to get what you want or if you can get away with some other relational operator to do it without conversion. NOTE: I have never tried this before - this is simply a guess on my part the_polyline is a linestring or multilinestring. SELECT * FROM polylines WHERE GeomFromText('POINT(295149 2315499)', -1) && the_polyline AND distance(BuildArea(the_polyline), GeomFromText('POINT(295149 2315499)', -1)) = 0 OR SELECT * FROM polylines WHERE GeomFromText('POINT(295149 2315499)', -1) && the_polyline AND Within(GeomFromText('POINT(295149 2315499)', -1),BuildArea(the_polyline)) -----Original Message----- From: postgis-users-bounces@... [mailto:postgis-users-bounces@...] On Behalf Of anhtin Sent: Wednesday, April 11, 2007 11:40 PM To: postgis-users@... Subject: [postgis-users] RE: RE: Select Point or PolyGon Polyline in Box Thanks very much so support for me if i have that point i want select this point be in Polygon ex: i have table Polygon is province. i want select point(295054 849444) be in Polygon ???? and or be in polyline can u show 2 way with polygon and polyline thanks befor :) Obe, Regina DND\MIS wrote: > > Don't quite get what you are asking? Are you trying to compare if 2 > points are the same or if a point is within x distance of another point? > or something entirely different? > > If you wanted to select all points within x distance of your reference > point , then it would be (again replace -1 with the correct SRID and > distance is always measured in the units of your spatial reference > system) > > SELECT * > FROM pointdemo > WHERE the_point && Expand(GeomFromText('POINT(295149 2315499)', -1), > AND > distance(the_point,GeomFromText('POINT(295149 2315499)', -1)) <= > 10 > > If you wanted to know if 2 points are the same then it would be > SELECT * > FROM pointdemo > WHERE the_point ~= GeomFromText('POINT(295149 2315499)', -1) > > > > > -----Original Message----- > From: postgis-users-bounces@... > [mailto:postgis-users-bounces@...] On Behalf Of > anhtin > Sent: Wednesday, April 11, 2007 12:32 AM > To: postgis-users@... > Subject: [postgis-users] RE: Select Point or PolyGon Polyline in Box > > > thanks > How is Select if it is Point ????? > > > > Obe, Regina DND\MIS wrote: >> >> Assuming your box is in the same srid as your points. It would be >> something like >> >> SELECT * >> FROM pointdemo >> WHERE the_point && setsrid('BOX(295149 2315499, 465992 >> 2163790)'::box2d, -1) >> >> >> Note - above I am assuming your point geometry is called the_point >> your SRID is -1 >> If the srid of your point geometry is not -1 then change -1 to what > it >> should be. >> >> >> -----Original Message----- >> From: postgis-users-bounces@... >> [mailto:postgis-users-bounces@...] On Behalf Of >> anhtin >> Sent: Tuesday, April 10, 2007 6:18 AM >> To: postgis-users@... >> Subject: [postgis-users] Select Point or PolyGon Polyline in Box >> >> >> hi all >> i have question to postgis >> i have table Pointdemo >> I want select all point in my Box("Rectangle") on PostGis >> my box is corrdinate >> ex: full extend is:Box(110638 2587481, 903350 1972446) ---> xmin >> xmax >> ymax >> i want select point in Box(295149 2315499, 465992 2163790) ---> xmin >> ymin, >> xmax ymax >> How will i do that ????? >> >> >> -- >> View this message in context: >> > >> html#a9916986 >> Sent from the PostGIS - User mailing list archive at Nabble.com. >> >> _______________________________________________ >> postgis-users mailing list >> postgis-users@... >> http://postgis.refractions.net/mailman/listinfo/postgis-users >> >> ----------------------------------------- >> The substance of this message, including any attachments, may be >> confidential, legally privileged and/or exempt from disclosure >> pursuant to Massachusetts law. It is intended >> solely for the addressee. If you received this in error, please >> contact the sender and delete the material from any computer. >> >> _______________________________________________ >> postgis-users mailing list >> postgis-users@... >> http://postgis.refractions.net/mailman/listinfo/postgis-users >> >> > > -- > View this message in context: > > html#a9933066 > Sent from the PostGIS - User mailing list archive at Nabble.com. > > _______________________________________________ > postgis-users mailing list > postgis-users@... > http://postgis.refractions.net/mailman/listinfo/postgis-users > _______________________________________________ > postgis-users mailing list > postgis-users@... > http://postgis.refractions.net/mailman/listinfo/postgis-users > > -- View this message in context: http://www.nabble.com/Select-Point-or-PolyGon-Polyline-in-Box-tf3552167. html#a9952489 Sent from the PostGIS - User mailing list archive at Nabble.com. _______________________________________________ postgis-users mailing list postgis-users@... http://postgis.refractions.net/mailman/listinfo/postgis-users _______________________________________________ postgis-users mailing list postgis-users@... http://postgis.refractions.net/mailman/listinfo/postgis-users |
|
|
RE: RE: RE: Select Point or PolyGon Polyline in Boxthanks very much all support to me :)
i still understand in Select point with PolyLine with command : when i run SELECT * FROM mainroad WHERE GeomFromText('POINT(517651 2121421)', 42102) && the_geom Have some result if have assgin to add the command: AND distance(BuildArea(the_geom), GeomFromText('POINT(517651 2121421)', 42102)) = 0 but it no result ????? i dont understand this command
|
|
|
RE: Select Point or PolyGon Polyline in Boxthanks reply
but have some problem i think the command doen't exact. because when i get box on the map have a porvince but when i run in post have 2 result ??? SELECT gid, name, code, ma FROM province WHERE the_geom && setsrid('BOX(472825.36726087 2140555.40234783,516561.185 2107753.53904348)'::box2d, 42102)
|
|
|
RE: Select Point or PolyGon Polyline in Box
|
|
|
RE: RE: Select Point or PolyGon Polyline in BoxHi anhtin,
In your province table, is your province the_geom a polygon or a point? That example I gave would work only for points since if the bounding box of a point is in a box, then the point is in the box. With a polygon - you could have a province partly in your box and partly out and also since && only compares bounding boxes, for a polygon just because the bounding box of the polygon is in your box doesn't guarantee your polygon is in your box. Its hard to tell without having a sample of the records you have so maybe you can send us the 2 that are coming up in the results so we could help further. To figure out if a polygon truly overlaps your box, then you would need to do SELECT gid, name, code, ma FROM province WHERE the_geom && setsrid('BOX(472825.36726087 2140555.40234783,516561.185 2107753.53904348)'::box2d, 42102) AND distance(the_geom, setsrid('BOX(472825.36726087 2140555.40234783,516561.185 2107753.53904348)'::box2d, 42102)) = 0 Now for the case where you have more than one province overlapping your box - it is questionable if you want to include both or if you just want to include the one that fits in better - in that case, you might want to pick the province where the centroid of the province fits in to get around silly cases like where a sliver of the province is in your box. E.g. SELECT gid, name, code, ma FROM province WHERE centroid(the_geom) && setsrid('BOX(472825.36726087 2140555.40234783,516561.185 2107753.53904348)'::box2d, 42102) Hope that helps, Regina -----Original Message----- From: postgis-users-bounces@... [mailto:postgis-users-bounces@...] On Behalf Of anhtin Sent: Friday, April 13, 2007 5:38 AM To: postgis-users@... Subject: [postgis-users] RE: Select Point or PolyGon Polyline in Box anhtin wrote: > > thanks reply > but have some problem > i think the command doen't exact. because when i get box on the map have a > porvince but when i run in post have 2 result ??? > > SELECT gid, name, code, ma FROM province > WHERE the_geom && setsrid('BOX(472825.36726087 > 2140555.40234783,516561.185 2107753.53904348)'::box2d, 42102) > > > when u show me ex: with point is excatly > SELECT * > FROM province WHERE GeomFromText('POINT(472825.36726087 > 2140555.40234783)', 42102) && the_geom > AND distance(the_geom, GeomFromText('POINT(472825.36726087 > 2140555.40234783)', 42102)) = 0 > > but i try same with Box is error > can u show me??? > > > Obe, Regina DND\MIS wrote: >> >> Assuming your box is in the same srid as your points. It would be >> something like >> >> SELECT * >> FROM pointdemo >> WHERE the_point && setsrid('BOX(295149 2315499, 465992 >> 2163790)'::box2d, -1) >> >> >> Note - above I am assuming your point geometry is called the_point >> your SRID is -1 >> If the srid of your point geometry is not -1 then change -1 to what it >> should be. >> >> >> -----Original Message----- >> From: postgis-users-bounces@... >> [mailto:postgis-users-bounces@...] On Behalf Of >> anhtin >> Sent: Tuesday, April 10, 2007 6:18 AM >> To: postgis-users@... >> Subject: [postgis-users] Select Point or PolyGon Polyline in Box >> >> >> hi all >> i have question to postgis >> i have table Pointdemo >> I want select all point in my Box("Rectangle") on PostGis >> my box is corrdinate >> ex: full extend is:Box(110638 2587481, 903350 1972446) ---> xmin >> xmax >> ymax >> i want select point in Box(295149 2315499, 465992 2163790) ---> xmin >> ymin, >> xmax ymax >> How will i do that ????? >> >> >> -- >> View this message in context: >> >> html#a9916986 >> Sent from the PostGIS - User mailing list archive at Nabble.com. >> >> _______________________________________________ >> postgis-users mailing list >> postgis-users@... >> http://postgis.refractions.net/mailman/listinfo/postgis-users >> >> ----------------------------------------- >> The substance of this message, including any attachments, may be >> confidential, legally privileged and/or exempt from disclosure >> pursuant to Massachusetts law. It is intended >> solely for the addressee. If you received this in error, please >> contact the sender and delete the material from any computer. >> >> _______________________________________________ >> postgis-users mailing list >> postgis-users@... >> http://postgis.refractions.net/mailman/listinfo/postgis-users >> >> > > -- View this message in context: http://www.nabble.com/Select-Point-or-PolyGon-Polyline-in-Box-tf3552167. html#a9975872 Sent from the PostGIS - User mailing list archive at Nabble.com. _______________________________________________ postgis-users mailing list postgis-users@... http://postgis.refractions.net/mailman/listinfo/postgis-users _______________________________________________ postgis-users mailing list postgis-users@... http://postgis.refractions.net/mailman/listinfo/postgis-users |
|
|
RE: RE: RE: RE: Select Point or PolyGon Polyline in BoxAnhtin,
Sorry I misunderstood what you were trying
to do. I guess your mainroads are just regular old lines and not boundary
lines of polygons. The buildarea is meant to take a closed line and
convert to a polygon. If its not closed I think it just returns
null.
I think what you want then if you are
trying to find what road a point sits on is
SELECT * FROM mainroad WHERE
GeomFromText('POINT(517651 2121421)', 42102)
&&
the_geom AND distance(the_geom, GeomFromText('POINT(517651 2121421)', 42102)) = 0 - and for that you don't need build
area
If you are dealing with centerlines - you
may however need to expand your line out a bit and check if a point sits within
x distance of a line if your points aren't exactly aligned on road
centerlines. Something like
SELECT * FROM mainroad WHERE
expand(GeomFromText('POINT(517651 2121421)', 42102),1)
&&
the_geom AND distance(the_geom, GeomFromText('POINT(517651 2121421)', 42102)) <= 1 where 1 you can replace with whatever you think is a
good measure for a width of a road.
Hope that helps,
Regina From: postgis-users-bounces@... on behalf of anhtin Sent: Thu 4/12/2007 10:39 PM To: postgis-users@... Subject: [postgis-users] RE: RE: RE: Select Point or PolyGon Polyline in Box thanks very much all support to me :) _______________________________________________ postgis-users mailing list postgis-users@... http://postgis.refractions.net/mailman/listinfo/postgis-users |
|
|
RE: RE: RE: RE: Select Point or PolyGon Polyline in Boxthanks very much :)
u dont know help me very much. I hope next time u will continue hepl me more :) happy to u.
|
| Free embeddable forum powered by Nabble | Forum Help |