Answer the question
In order to leave comments, you need to log in
How to make a map with delivery zones for a pizzeria based on yandex or google?
Hello.
There is such a task - to make a delivery zone on the site of a pizzeria with the ability to check the address - is it included in the delivery zone or not, if it is, then which one?
I have this idea.
Draw a polygon (polygons) of the delivery area on the map, get an address from the client via api, get an array of addresses from the polygon, compare, and return the result.
And it is desirable that the polygon is limited to streets.
It doesn't matter which api it is, although it's interesting for both Google and Yandex :)
Please
don't kick right away - I'm not a programmer, I'm just learning :)
I didn't understand the zone. I also did not find how to request address verification - is it in the zone or not :(
Answer the question
In order to leave comments, you need to log in
In principle this is possible. But vryatli means API in its purest form. I would do with radial zones.
Let's say there are three points (starting points). For each, the radius of the service area is indicated. You receive data about the delivery point and check on your own which zone this point belongs to. If there are several, then you can determine the nearest center, or some other principle. Ultimately, everything will come down to elementary geometry.
There are arbitrary zones and it is possible to calculate either hitting the cascade of zones *1,2,3 .. or finding a hit in one zone, and also build a route, take travel time from it ..
Everything is done very simply using the Yandex / Google / other maps API and mysql / postgresql ... You
can find the solution to your problem at clubs.ya.ru/mapsapi
Read also about spatial data.
1. make a polygon editor
2. save the coordinates of your polygon to the base in spacial data
3. make requests to hit a point in the area
// mysql
SELECT * FROM TABLE WHERE CONTAINS(polygon, GeomFromText(:point)
:point'= POINT({$lat} {$lng})
select AsText(`polygon`) AS polygon from table
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question