I
I
Ilya Magdenko2018-01-10 20:26:46
WordPress
Ilya Magdenko, 2018-01-10 20:26:46

How to search for all places from the base from point a to point b?

Hello!
There was one question here. Let's say I have a webapp where the user needs to enter the data of his starting point and the end point of the route. The geodata of points are also located in the database. So, if along the entire route of the user (the route will have to be compiled thanks to Google maps) within a radius of, for example, 15 miles from the road, there is a point, then display it to the user.
Maybe it's a simple question, but it's not clear to me how to do this. Tell me what you need to read and study. Which way to move.
Thank you!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
Pashenka, 2019-10-29
@like-a-boss

Why not just change the url of the "Data" page to something other than data?
Or a little more difficult - change the url for a custom post type in the custom post type registration function:

$args = array(
    // остальные аргументы
    'rewrite' => array( 
        'slug' => 'products', // здесь указать желаемый слаг для url
        'with_front' => FALSE
    ),
);
register_post_type( 'data', $args );

E
eRKa, 2018-01-11
@duntik

This is called building a trajectory with a buffer. To do this, based on the trajectory and the buffer, a polygon is built, and then a standard algorithm for entering a point into a polygon.
To write the transformation of a line into a polygon myself is a hemorrhoid, I tried). Circles are built from points, then rectangles along lines, then triangulation is done, then all internal triangles are removed. But this is still half the trouble, because there is a difference in the distance per degree in the north and south, and I did not manage to take into account this coefficient at each point of the polygon, in general, the polygon turned out to be curved. I wrote in C # and I did not find a library that would do this. But I found one on js turf. When the client builds a trajectory, specifies a buffer, then when saving, the polygon is built on the client and the already transformed geojson is sent to the server.
Polygon from a trajectory with a buffer, I did this

var lineWithBuffer = turf.buffer(line, buffer, 'meters');
geo.features[i].geometry = lineWithBuffer.geometry;

D
Dimonchik, 2018-01-10
@dimonchik2013

www.simplecoding.org/kak-pokazat-na-google-maps-ob...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question