Search code examples
arrayslaravelsavecoordinates

How to store multi place borders coordinates many times to create a polyline


I'm having a big headache with how to store multiple borders for a place. I got a place table which contains id-lat-long-totalspace-borders in this border I want to save multiple latlong.


Solution

  • There are many ways to do this, on top of mind I have 2 options:

    1. In your current borders field. Store the borders in a specific format, e.g. "112.12,32.42;421.42,42,53;421.42,42,53;421.42,42,53;421.42,42,53". In this format, each border is separated by semicolon, the long and lat is separated by comma

    2. Or create a separate table borders and store them in that table, the fields are id, place_id, lat, long