1

I'm sorry for my english! I have to get the following informations: I have a specific point with long/lat. Then i draw a circle with a specific radius (e.g. 5km). The intersections of all roads on the line of the circle must be displayed as a point.

My idea with photoshop:

circle

I'm not a real coder, but a mathematician...

So I had the idea to calculate all coordinates, which have the specific radius (e.g. 5km) on the first step. The second step is to check, if the point is on a road. If the point is on a road, I save it in an array. If the point isn't on a road, I delete the point for the session. The third step is to display all points of the array on a map.

That first step works. The distance between the points on the line of the circle are about 0,5m. That is an acceptable tolerance. I get a list of coordinates with PHP. E.g. with 1km radius:

  • B 32.0179859432° L 20.999880002°
  • B 32.0179846637° L 20.9997800137°
  • B 32.0179825847° L 20.9996800441°
  • B 32.0179797064° L 20.9995801021°
  • B 32.0179760289° L 20.9994801966°
  • B 32.0179715527° L 20.9993803363°
  • B 32.0179662781° L 20.9992805303°
  • B 32.0179602056° L 20.9991807874°
  • B 32.0179533358° L 20.9990811164°
  • ...

But that are to many results depending on the distance. 1km: 6663 points 10km: 66630 points ...

That are to many points. I can't use a reverse geocoding service to check, if every point is on a road. That would be about 60000 requests in one query. I believe, that only 0,1 % of the points are on a road, so my solution is not very efficient.

Do you habe any idea to solve my problem?? Maybe with frameworks like openlayers, or ...? Or API's, which can display all coordinates with an specific distance to one point?

  • 1
    postgis can use ST_Intersect with the circle and return just the intersection points. – Mapperz Aug 18 '16 at 20:10
  • Here is the real time example geocodezip.com/v2_marcelo_driveTimePolygon.html – Mapperz Aug 18 '16 at 20:20
  • There are an infinite number of points on a line so I wouldn't recommend doing it that way. Your first challenge is to create a circle buffer of 5km from a point in geographic; If you're trying to do the maths yourself you're doing it the hard way - Mapperz has a good idea, but start with projecting the point to UTM (choose zone) then buffer to a circle and intersect with the roads - much easier and only a few lines of code. – Michael Stimson Aug 18 '16 at 21:27
  • Thank you very much Mapperz and Michael Miles-Stimson! The real time example doesn't really solve my problem. Maybe I explained it wrong. I only want the points, which touching the line of the circle. Not the points, which are inside the circle. And then the informations about the points (name and type of road) – TheRarios Aug 18 '16 at 22:20
  • @MichaelMiles-Stimson I know, that is my task an not yours, but can you explain me, how i have to "start with projecting the point to UTM (choose zone) then buffer to a circle and intersect with the roads"? It sounds very great. – TheRarios Aug 18 '16 at 22:22

Your Answer

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

Browse other questions tagged or ask your own question.