Link to home
Create AccountLog in
Avatar of APD Toronto
APD TorontoFlag for Canada

asked on

Plot Locations on Google Map

Hello Experts,

I have MySQL table with Canadian addresses and Postal Codes, and based on the user search, I would like to list these locations on the page (I know how), but also plot them on Google Maps and somehow associate each with those listed. Maybe somehow number each marker, and I am wondering if someone can help me get started.

I already got my Billing account setup and my API key. Under My Project I added Google Maps JS library and removed everything else, such as Google cloud.

I read that I need to plot using longitude and latitude, but I only have Postal Codes and addresses, so I am assuming that I need to use the API somehow to get long/lat and save them in the DB, so I don't overuse my API.

As well, for security reasons how do I store my API key in php and not in js, although I did setup IP restrictions. If this good enough?

Finally, would I be able to use the API in php and not in js as this is more convenient to save the results back to the DB?
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

there is an open source database of the postal codes and lat long
https://geocoder.ca/?register=1&capostal=1
Avatar of APD Toronto

ASKER

Can't the Google API do this as well? Any other advise?
Given an address the google api can return the postal code which has nothing to do with your original question.
ASKER CERTIFIED SOLUTION
Avatar of APD Toronto
APD Toronto
Flag of Canada image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer