4

I'm trying to figure this out, so I wanted to try asking to the experts.

This question is related to PostGIS (from postgresql).

What I want is:

1) Based on a longitude and latitude I want project a single point (similar on how you can pass the lat and lon to a google map and then have a single point projected).

2) Create a circle geometry around that with a radius. (I'm going to determine the radius based on the horizontal accuracy of the Lat/Lon)

3) Then, I want to do 1 and 2 again to another Lat/Lon combination. And see if those two circles touch.


I suppose for point 2), I could use a constructor like ST_GeomFromText, however I dont quite understand yet how I can project a single point based on two spherical angles (lat/lon).

Then for point 3, I guess I could use something like ST_Touches

  • I'm not sure what you mean by project in this context? ST_MakePoint, perhaps? For 2, look at ST_Buffer and for 3, ST_Touches or ST_Intersects. – John Powell Oct 15 '15 at 20:05
3

I'll post this code to solve part of the problem, as I don't know what you're trying to do with the map part, but here goes:

SELECT 
ST_Touches(temp.point1, temp.point2) as geom_touches
, ST_Intersects(temp.point1, temp.point2) as geom_intersect

FROM (

SELECT * FROM 
ST_Buffer(ST_Transform(ST_GeomFromText('POINT(-105.05083 39.74823)', 4326), 2877), 1500) as point1
, ST_Buffer(ST_Transform(ST_GeomFromText('POINT(-105.04428 39.74779)', 4326), 2877), 1500) as point2

 )as temp

This will:
- create 2 geometries in a temp table, both in SRID:4326 using ST_GeomFromText
- transform those two geometries to a projected coordinate system in Feet (state plane Colorado)
- buffer those points by a distance (1500 feet)
- use an outer SQL statement to test if they touch, and if they intersect

And the results look like this:

enter image description here

And the geometries look like this:

enter image description here

  • Basically my doubt here is with the "POINT(-105.05083 39.74823)" part you are using. Thing is, How can I know how to create that point when what I have is just two angles (Latitude and Longitude). – Rod Navarro Oct 15 '15 at 20:00
  • the ST_GeomFromText takes the LAT and LON but without the comma in between, so what you pasted above is X/ LON: -105.05083 and Y/ LAT: 39.74823 - but I think I'm missing something in your workflow... let me know if you're still after something here... – DPSSpatial Oct 15 '15 at 20:31

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.