A
A
Andrew2014-11-10 00:15:32
Google Maps
Andrew, 2014-11-10 00:15:32

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

5 answer(s)
U
ugodrus, 2014-11-10
@ugodrus

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.

Y
yttrium, 2014-11-10
@yttrium

Selection of geo objects

F
Fenomen51, 2014-12-03
@Fenomen51

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 ..

Z
Zohei, 2015-02-17
@Zohei

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})

4. to display the polygon back on the map, make something like this request select AsText(`polygon`) AS polygon from table
and then format the received coordinates into a readable form for js

V
Victor, 2017-01-25
@DarkByte2015

This means that there are untracked files in the current working tree that will be overwritten by merge, and Git prevents you from losing possibly important files.
You need to either delete them, or commit them, or make stash, or add them to .gitignore.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question