I am trying to get every parcel within 62ft of a particular road.

I use this to get the road.

select road_name, geom
from road
where road_name = 'marvin';

Now i want to find the parcels that lay on both sides of the road, going out 65ft each side. I was thinking about using st_DWithin .

select pid, geom, name
from land
ST_DWithin (select road_name, geom from road where road_name = 'marvin'), 65);

Is this correct?

The SRID is 26986.

  • Please edit the question to specify the exact spatial reference (SRID) in use. – Vince Mar 13 '17 at 20:59
  • So your search is 65 meters, since that's the unit of measure for that SRID. – Vince Mar 13 '17 at 21:47
  • A sub-select is not necessary for this query, so I suggest to learn how to use a LEFT JOIN, like in the previously linked blog, which will select information from two tables. – Mike T Mar 13 '17 at 22:21
  • yes the same units – Schoollife Mar 13 '17 at 22:49
  • UPDATE NO THE UNIT IS 65FT NEED TO BE THE DISTANCE – Schoollife Mar 13 '17 at 23:01

Generally stated, PostGIS functions that work on aspects of geometry or geography require or yield values that are in the same units as those specified or implied by the CRS.

If your CRS works in meters, you'll need to convert feet measures to meters. Multiply feet by exactly 0.3048 to get meters.

Also, you don't need to select road_name, geom ..., just select geom ....

  • I am sorry for the ST_DWithin () , I need to remove the road_name , and just leave geom. – Schoollife Mar 13 '17 at 23:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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