Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

i can get all polygon on intersects this:-7.9245860488441 -37.122384500713,-7.9245860488441 -37.11904223938,-7.9233955716106 -37.1187601948

SELECT * 
FROM propriedades 
WHERE ST_Intersects(
    ST_GeomFromText(location::geometry),
    ST_GeomFromText('POLYGON(-7.9245860488441 -37.122384500713,-7.9245860488441 -37.11904223938,-7.9233955716106 -37.1187601948)'));

propriedades is my table location is a colunm on are saved geography polygons

the returned error

ERROR: parse error - invalid geometry HINT: "POLYGON(-7.9245860488441 " <-- parse error at position 25 within geometry

*** Error ***

ERROR: parse error - invalid geometry SQL state: XX000 Hint: "POLYGON(-7.9245860488441 " <-- parse error at position 25 within geometry

edit ---

trying double parentheses:

ERROR: parse error - invalid geometry HINT: "0103000020E610000001000000150000008C" <-- parse error at position 36 within geometry

solved, i used the geography, no geometry:

SELECT * 
FROM propriedades 
WHERE ST_Intersects(
    location,
    'POLYGON((-7.9239281216632 -37.118491021708,-7.9239281216632 -37.116096663161,-7.9240937813677 -37.116105295265,-7.9241591799314 -37.116171875421,-7.9246636046819 -37.116271405188,-7.9259677455811 -37.118572530098,-7.9256079206171 -37.118728486796,-7.9243335012771 -37.118675962065,-7.9243194973485 -37.11849254918,-7.9242705964918 -37.118491021708,-7.9239281216632 -37.118491021708))'
)

but have other problem, i want intersects> 50 meters

share|improve this question
    
Don't you need two parentheses to begin a polygon? See gis.stackexchange.com/questions/28824 for examples of proper usage. –  whuber Sep 19 '12 at 18:02
    
i tryed this and the error:ERROR: parse error - invalid geometry HINT: "0103000020E610000001000000150000008C" <-- parse error at position 36 within geometry –  Ciro Vargas Sep 19 '12 at 18:08
    
That's obviously garbage: what (decimal) number has a "C" in it? Please look closely at your error messages: they give you useful information! –  whuber Sep 19 '12 at 18:10
    
geography dont is a decimal –  Ciro Vargas Sep 19 '12 at 18:18
1  
In the current form, it is hard to see what question you are currently asking for. The clearer you are able to state the problem you are having, the more likely you are to receive an answer that make sense. If you have a multi-step problem, try breaking it down and working through your process until you hit an error, then post a question specifically about that error. –  Get Spatial Sep 19 '12 at 20:00
show 6 more comments

closed as not a real question by Get Spatial, underdark Sep 19 '12 at 20:11

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

solved, i used the geography, no geometry:

SELECT * 
FROM propriedades 
WHERE ST_Intersects(
    location,
    'POLYGON((-7.9239281216632 -37.118491021708,-7.9239281216632 -37.116096663161,-7.9240937813677 -37.116105295265,-7.9241591799314 -37.116171875421,-7.9246636046819 -37.116271405188,-7.9259677455811 -37.118572530098,-7.9256079206171 -37.118728486796,-7.9243335012771 -37.118675962065,-7.9243194973485 -37.11849254918,-7.9242705964918 -37.118491021708,-7.9239281216632 -37.118491021708))'
)

i can get inteserctions when the distance of sides of polygons is greater than 50 meters :

SELECT p.*,ST_Distance(
    location,
    'POLYGON((-7.9239281216632 -37.118491021708,-7.9239281216632 -37.116096663161,-7.9240937813677 -37.116105295265,-7.9241591799314 -37.116171875421,-7.9246636046819 -37.116271405188,-7.9259677455811 -37.118572530098,-7.9256079206171 -37.118728486796,-7.9243335012771 -37.118675962065,-7.9243194973485 -37.11849254918,-7.9242705964918 -37.118491021708,-7.9239281216632 -37.118491021708))'
) as dist 
FROM propriedades p
WHERE ST_Intersects(
    ST_Buffer(location, -50.0),
    'POLYGON((-7.9239281216632 -37.118491021708,-7.9239281216632 -37.116096663161,-7.9240937813677 -37.116105295265,-7.9241591799314 -37.116171875421,-7.9246636046819 -37.116271405188,-7.9259677455811 -37.118572530098,-7.9256079206171 -37.118728486796,-7.9243335012771 -37.118675962065,-7.9243194973485 -37.11849254918,-7.9242705964918 -37.118491021708,-7.9239281216632 -37.118491021708))'
)

used a negative buffer

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.