Save the coordinates with Phalcon

Save the coordinates with Phalcon

Hello, have a nice day. I wanted to ask if it is that phalcon has any use to store the GPS coordinates or detect them with Google Maps on the cell phone. of not having a cell phone located on the Map. Is there any special input for this? Thanks a lot for your help

edited 19d ago

I'm not sure I understand you, but here is how I handle Coordinates in MySQL and Phalcon.

Field type in db: point

Writing

$this->coords = new \Phalcon\Db\RawValue('POINT('. $this->getDI()->getRequest()->getPost('coords') .')');
// Post coords look like: 25.7616, -80.1917

Reading

$this->view->coordinates = $this->modelsManager->createBuilder()
        ->columns([
            'X(coords) AS latitude', 
            'Y(coords) AS longitude'
        ])
        ->from('Models\Ports')
        ->where('id = :id:', ['id' => $id])
        ->getQuery()->getSingleResult();

And here it how it looks like in the CMS:

User can drag and drop or search with google maps api and im populating the input with a callback.



52.7k

If exactly I need to choose a location of the Map and load in an input the coordinates. I will implement it at this time