A
A
Anton Natarov2016-06-09 12:59:40
Yii
Anton Natarov, 2016-06-09 12:59:40

Yii2 Yandex Google Map, how to implement and store in the database?

Guys, such a question. Do you have modules for Yandex or Google maps in your developments?
The task is as follows, the user can put several marks on the map, marking his addresses.
I don’t really know how to get these coordinates (from the user because I haven’t done this before) and how to store them in the database in terms of the type these X and Y ?
On the frontend, I kind of tried to poke the cards and connect the labels as described in the API. Everything works and plows, but I don’t really understand how to set them and how to store them in the database. Can you advise how you do it?
As for adding addresses. Basically, this is 1 address = 1 row in the database. Those. not a pack of labels, but one at a time.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
Kirill Arutyunov, 2016-06-09
@HanDroid

https://github.com/kalyabin/yii2-select-google-map...
I used this admin extension.
True, I needed to store only 1 address for one entity.
Google, in my opinion, forbids having multiple map instances on 1 page.
But definitely worth a try.
If anything, you can inherit from this extension and add it to the use of several labels for 1 entity.
PS. If you write your own, then you will have a text-input + map. The event map has a click + move mark. As soon as the label appears on the map, we add a hidden input with the coordinates of the label to the form. New label - new input. Moved the label - changed the input.
The text input is needed so that you do not put a mark on the map with your hands, but indicate the address in the text input, and through the API determine the coordinates of the address and put a mark on these coordinates.

V
VitGun, 2016-06-09
@VitGun

You create longitude and latitude fields and store label coordinates there.

D
devian3000, 2016-06-09
@devian3000

The databases have fields for geotags. I definitely have it in myself postgres. Accept Ajax. At the time of the bid tag. Or post from a form.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question