Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

athulya's avatar

How to get longitude and latitude from zip and place in Laravel 8 ?

Hi,

I have a seeder function to import a CSV file which contains zip code and place name to the DB. Now Along with the zip and place I want to find out the coordinates of that place corresponding to the zip and place for each entry of the table where I previously imported the file.

How can I do that? Any suitable package available which I can run at the seeder itself? So that I can do both import and insert coordinates at the same time during the seeding time.

0 likes
7 replies
athulya's avatar

@Sirik Sorry, I don't understand, How can I use this in my Laravel seeder?

CarlEOgden's avatar

@athulya if you go to that website, then click on Free Postal Code Data then choose the country of choice (ch.zip is Switzerland) then you can read the text file into a database and use that! An easy fix for free!

1 like
athulya's avatar

@Snapey is from multiple countries, majority is from Switzerland. I have more than 1000 zip codes and places in table, and i want to add its corresponding coordinates too in the same table.

Please or to participate in this conversation.