We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

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 Nov '18

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

Field type in db: point


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


$this->view->coordinates = $this->modelsManager->createBuilder()
            'X(coords) AS latitude', 
            'Y(coords) AS longitude'
        ->where('id = :id:', ['id' => $id])

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.


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