{"id":1328,"date":"2016-03-11T18:44:17","date_gmt":"2016-03-11T18:44:17","guid":{"rendered":"https:\/\/www.codexworld.com\/?p=1328"},"modified":"2024-06-25T12:13:40","modified_gmt":"2024-06-25T12:13:40","slug":"get-latitude-longitude-from-address-using-google-maps-api-php","status":"publish","type":"post","link":"https:\/\/www.codexworld.com\/get-latitude-longitude-from-address-using-google-maps-api-php\/","title":{"rendered":"Get Latitude and Longitude from Address with Google Maps API using PHP"},"content":{"rendered":"<p>Latitude and longitude are used in the geographic coordinate system helps to measure position on the earth. In web applications, the latitude and longitude are used to mark the exact location on Google Maps. When we are using Google Maps to display location on the website, it&#8217;s always a good idea to set latitude and longitude in the Google Maps API code. Latitude &#038; Longitude are very useful for pointing accurate locations and placing markers at the correct position on Google Maps.<\/p>\n<p>The latitude and longitude coordinates can be retrieved from the address with Geocoding API using PHP. In this tutorial, we will show you how to <b>get latitude and longitude from address in PHP<\/b> using Google Maps Geocoding API.<\/p>\n<h2>Google Maps API Key<\/h2>\n<p>The Google Maps API Key is required to post request to Geocoding API and get response. Before getting started create an API key on Google Cloud console.<\/p>\n<ul>\n<li>Go to the <a href=\"https:\/\/console.cloud.google.com\/\" target=\"_blank\" rel=\"noopener\">Google Cloud console<\/a>.<\/li>\n<li>Select the project from the Project drop-down menu at the top. If you don&#8217;t have an existing project, create a new one.<\/li>\n<li>In the left navigation pane, select the <b>APIs &#038; Services<\/b> &raquo; <b>Credentials<\/b>.<\/li>\n<li>In the Credentials page, select <b>CREATE CREDENTIALS<\/b> &raquo; <b>API key<\/b>.<\/li>\n<li>The API key will be created and a dialog will appear with the newly created API key.<\/li>\n<li>Navigate to the Library page from the left menu panel and make sure the <b>Geocoding API<\/b> is enabled.<\/li>\n<\/ul>\n<p>Copy this API key for later use in the script on the Google Maps Geocoding API request.<\/p>\n<h2>Get Latitude and Longitude from Address using PHP<\/h2>\n<p>The following example code shows steps to find latitude and longitude from a given address using Google Geocoding API and PHP.<\/p>\n<ul>\n<li>Set the required values in the defined variable.\n<ul>\n<li><code>$GOOGLE_API_KEY<\/code> &#8211; Specify the Google API Key.<\/li>\n<li><code>$address<\/code> &#8211; Specify the address from which you want to get latitude and longitude coordinates.<\/li>\n<\/ul>\n<\/li>\n<li>Format the address by replacing the blank space with a plus sign (+).<\/li>\n<li>Request Google Geocoding API (<code>https:\/\/maps.googleapis.com\/maps\/api\/geocode\/json<\/code>) using the file_get_contents() method in PHP.<\/li>\n<li>Pass address and key parameters in the Geocoding API URL.<\/li>\n<li>Decode JSON response returned by the Geocoding API using PHP json_decode() function.<\/li>\n<li>Get latitude and longitude info from the <code>geometry<\/code> object of API response.<\/li>\n<\/ul>\n<pre><span style=\"color: #0000BB\">&lt;?php <br \/> <br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;Google&nbsp;Maps&nbsp;API&nbsp;Key <br \/><\/span><span style=\"color: #0000BB\">$GOOGLE_API_KEY&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">'YOUR_API_KEY'<\/span><span style=\"color: #007700\">; <br \/> <br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;Address&nbsp;from&nbsp;which&nbsp;the&nbsp;latitude&nbsp;and&nbsp;longitude&nbsp;will&nbsp;be&nbsp;retrieved <br \/><\/span><span style=\"color: #0000BB\">$address&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">'White&nbsp;House,&nbsp;Pennsylvania&nbsp;Avenue&nbsp;Northwest,&nbsp;Washington,&nbsp;DC,&nbsp;United&nbsp;States'<\/span><span style=\"color: #007700\">; <br \/> <br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;Formatted&nbsp;address <br \/><\/span><span style=\"color: #0000BB\">$formatted_address&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">str_replace<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'&nbsp;'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #DD0000\">'+'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$address<\/span><span style=\"color: #007700\">); <br \/> <br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;Get&nbsp;geo&nbsp;data&nbsp;from&nbsp;Google&nbsp;Maps&nbsp;API&nbsp;by&nbsp;address <br \/><\/span><span style=\"color: #0000BB\">$geocodeFromAddr&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">file_get_contents<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">\"https:\/\/maps.googleapis.com\/maps\/api\/geocode\/json?address=<\/span><span style=\"color: #007700\">{<\/span><span style=\"color: #0000BB\">$formatted_address<\/span><span style=\"color: #007700\">}<\/span><span style=\"color: #DD0000\">&amp;key=<\/span><span style=\"color: #007700\">{<\/span><span style=\"color: #0000BB\">$GOOGLE_API_KEY<\/span><span style=\"color: #007700\">}<\/span><span style=\"color: #DD0000\">\"<\/span><span style=\"color: #007700\">); <br \/> <br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;Decode&nbsp;JSON&nbsp;data&nbsp;returned&nbsp;by&nbsp;API <br \/><\/span><span style=\"color: #0000BB\">$apiResponse&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">json_decode<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$geocodeFromAddr<\/span><span style=\"color: #007700\">); <br \/> <br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;Retrieve&nbsp;latitude&nbsp;and&nbsp;longitude&nbsp;from&nbsp;API&nbsp;data <br \/><\/span><span style=\"color: #0000BB\">$latitude&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$apiResponse<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">results<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #0000BB\">0<\/span><span style=\"color: #007700\">]-&gt;<\/span><span style=\"color: #0000BB\">geometry<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">location<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">lat<\/span><span style=\"color: #007700\">;&nbsp; <br \/><\/span><span style=\"color: #0000BB\">$longitude&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$apiResponse<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">results<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #0000BB\">0<\/span><span style=\"color: #007700\">]-&gt;<\/span><span style=\"color: #0000BB\">geometry<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">location<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">lng<\/span><span style=\"color: #007700\">; <br \/> <br \/><\/span><span style=\"color: #0000BB\">?&gt;<\/span><\/pre>\n<p>Additionally, you can get the formatted address using the following code.<\/p>\n<pre><span style=\"color: #0000BB\">$formatted_address&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$apiResponse<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">results<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #0000BB\">0<\/span><span style=\"color: #007700\">]-&gt;<\/span><span style=\"color: #0000BB\">formatted_address<\/span><span style=\"color: #007700\">;&nbsp;<\/span><\/pre>\n<p>Display latitude and longitude on the web page.<\/p>\n<pre><span style=\"color: #FF8000\">\/\/&nbsp;Render&nbsp;the&nbsp;latitude&nbsp;and&nbsp;longitude&nbsp;of&nbsp;the&nbsp;given&nbsp;address <br \/><\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #DD0000\">'Latitude:&nbsp;'<\/span><span style=\"color: #007700\">.<\/span><span style=\"color: #0000BB\">$latitude<\/span><span style=\"color: #007700\">; <br \/>echo&nbsp;<\/span><span style=\"color: #DD0000\">'&lt;br\/&gt;Longitude:&nbsp;'<\/span><span style=\"color: #007700\">.<\/span><span style=\"color: #0000BB\">$longitude<\/span><span style=\"color: #007700\">;<\/span><\/pre>\n<p class=\"seeAlso\"><span><\/span><a href=\"https:\/\/www.codexworld.com\/get-geolocation-from-ip-address-using-php\/\">Get Geolocation from IP Address using PHP<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Latitude and longitude are used in the geographic coordinate system helps to measure position on the earth. In web applications, the latitude and longitude are used to mark the exact location on Google Maps. When <\/p>\n","protected":false},"author":1,"featured_media":5533,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4],"tags":[250,380,13,35,155,156,14],"class_list":["post-1328","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","tag-api","tag-geocoding","tag-google-api","tag-google-maps-api","tag-latitude","tag-longitude","tag-php","cat-4-id","has_thumb"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Get Latitude and Longitude from Address with Google Maps API using PHP - CodexWorld<\/title>\n<meta name=\"description\" content=\"Find Latitude and Longitude from Address using PHP - PHP function to get latitude and longitude from address using Google Maps API and PHP.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codexworld.com\/get-latitude-longitude-from-address-using-google-maps-api-php\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Get Latitude and Longitude from Address with Google Maps API using PHP - CodexWorld\" \/>\n<meta property=\"og:description\" content=\"Find Latitude and Longitude from Address using PHP - PHP function to get latitude and longitude from address using Google Maps API and PHP.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codexworld.com\/get-latitude-longitude-from-address-using-google-maps-api-php\/\" \/>\n<meta property=\"og:site_name\" content=\"CodexWorld\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:published_time\" content=\"2016-03-11T18:44:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-06-25T12:13:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/03\/get-latitude-longitude-from-address-using-google-maps-geocoding-api-php-codexworld.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"CodexWorld\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@codexworldblog\" \/>\n<meta name=\"twitter:site\" content=\"@codexworldweb\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"CodexWorld\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/get-latitude-longitude-from-address-using-google-maps-api-php\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/get-latitude-longitude-from-address-using-google-maps-api-php\\\/\"},\"author\":{\"name\":\"CodexWorld\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\"},\"headline\":\"Get Latitude and Longitude from Address with Google Maps API using PHP\",\"datePublished\":\"2016-03-11T18:44:17+00:00\",\"dateModified\":\"2024-06-25T12:13:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/get-latitude-longitude-from-address-using-google-maps-api-php\\\/\"},\"wordCount\":406,\"commentCount\":5,\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/get-latitude-longitude-from-address-using-google-maps-api-php\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2016\\\/03\\\/get-latitude-longitude-from-address-using-google-maps-geocoding-api-php-codexworld.png\",\"keywords\":[\"API\",\"Geocoding\",\"Google API\",\"Google Maps API\",\"Latitude\",\"Longitude\",\"PHP\"],\"articleSection\":[\"PHP\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/get-latitude-longitude-from-address-using-google-maps-api-php\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/get-latitude-longitude-from-address-using-google-maps-api-php\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/get-latitude-longitude-from-address-using-google-maps-api-php\\\/\",\"name\":\"Get Latitude and Longitude from Address with Google Maps API using PHP - CodexWorld\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/get-latitude-longitude-from-address-using-google-maps-api-php\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/get-latitude-longitude-from-address-using-google-maps-api-php\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2016\\\/03\\\/get-latitude-longitude-from-address-using-google-maps-geocoding-api-php-codexworld.png\",\"datePublished\":\"2016-03-11T18:44:17+00:00\",\"dateModified\":\"2024-06-25T12:13:40+00:00\",\"description\":\"Find Latitude and Longitude from Address using PHP - PHP function to get latitude and longitude from address using Google Maps API and PHP.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/get-latitude-longitude-from-address-using-google-maps-api-php\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/get-latitude-longitude-from-address-using-google-maps-api-php\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/get-latitude-longitude-from-address-using-google-maps-api-php\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2016\\\/03\\\/get-latitude-longitude-from-address-using-google-maps-geocoding-api-php-codexworld.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2016\\\/03\\\/get-latitude-longitude-from-address-using-google-maps-geocoding-api-php-codexworld.png\",\"width\":1920,\"height\":1080,\"caption\":\"get-latitude-longitude-from-address-using-google-maps-geocoding-api-php-codexworld\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/get-latitude-longitude-from-address-using-google-maps-api-php\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.codexworld.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Get Latitude and Longitude from Address with Google Maps API using PHP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"name\":\"CodexWorld\",\"description\":\"Web &amp; Mobile App Development Company\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.codexworld.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\",\"name\":\"CodexWorld\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"width\":200,\"height\":19,\"caption\":\"CodexWorld\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldweb\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/codexworld\",\"https:\\\/\\\/www.youtube.com\\\/codexworld\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\",\"name\":\"CodexWorld\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"caption\":\"CodexWorld\"},\"description\":\"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.\",\"sameAs\":[\"http:\\\/\\\/www.codexworld.com\",\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldblog\"],\"url\":\"https:\\\/\\\/www.codexworld.com\\\/author\\\/nitya192265\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Get Latitude and Longitude from Address with Google Maps API using PHP - CodexWorld","description":"Find Latitude and Longitude from Address using PHP - PHP function to get latitude and longitude from address using Google Maps API and PHP.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.codexworld.com\/get-latitude-longitude-from-address-using-google-maps-api-php\/","og_locale":"en_US","og_type":"article","og_title":"Get Latitude and Longitude from Address with Google Maps API using PHP - CodexWorld","og_description":"Find Latitude and Longitude from Address using PHP - PHP function to get latitude and longitude from address using Google Maps API and PHP.","og_url":"https:\/\/www.codexworld.com\/get-latitude-longitude-from-address-using-google-maps-api-php\/","og_site_name":"CodexWorld","article_publisher":"https:\/\/www.facebook.com\/codexworld","article_author":"https:\/\/www.facebook.com\/codexworld","article_published_time":"2016-03-11T18:44:17+00:00","article_modified_time":"2024-06-25T12:13:40+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/03\/get-latitude-longitude-from-address-using-google-maps-geocoding-api-php-codexworld.png","type":"image\/png"}],"author":"CodexWorld","twitter_card":"summary_large_image","twitter_creator":"@codexworldblog","twitter_site":"@codexworldweb","twitter_misc":{"Written by":"CodexWorld","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codexworld.com\/get-latitude-longitude-from-address-using-google-maps-api-php\/#article","isPartOf":{"@id":"https:\/\/www.codexworld.com\/get-latitude-longitude-from-address-using-google-maps-api-php\/"},"author":{"name":"CodexWorld","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0"},"headline":"Get Latitude and Longitude from Address with Google Maps API using PHP","datePublished":"2016-03-11T18:44:17+00:00","dateModified":"2024-06-25T12:13:40+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codexworld.com\/get-latitude-longitude-from-address-using-google-maps-api-php\/"},"wordCount":406,"commentCount":5,"publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"image":{"@id":"https:\/\/www.codexworld.com\/get-latitude-longitude-from-address-using-google-maps-api-php\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/03\/get-latitude-longitude-from-address-using-google-maps-geocoding-api-php-codexworld.png","keywords":["API","Geocoding","Google API","Google Maps API","Latitude","Longitude","PHP"],"articleSection":["PHP"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.codexworld.com\/get-latitude-longitude-from-address-using-google-maps-api-php\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.codexworld.com\/get-latitude-longitude-from-address-using-google-maps-api-php\/","url":"https:\/\/www.codexworld.com\/get-latitude-longitude-from-address-using-google-maps-api-php\/","name":"Get Latitude and Longitude from Address with Google Maps API using PHP - CodexWorld","isPartOf":{"@id":"https:\/\/www.codexworld.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codexworld.com\/get-latitude-longitude-from-address-using-google-maps-api-php\/#primaryimage"},"image":{"@id":"https:\/\/www.codexworld.com\/get-latitude-longitude-from-address-using-google-maps-api-php\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/03\/get-latitude-longitude-from-address-using-google-maps-geocoding-api-php-codexworld.png","datePublished":"2016-03-11T18:44:17+00:00","dateModified":"2024-06-25T12:13:40+00:00","description":"Find Latitude and Longitude from Address using PHP - PHP function to get latitude and longitude from address using Google Maps API and PHP.","breadcrumb":{"@id":"https:\/\/www.codexworld.com\/get-latitude-longitude-from-address-using-google-maps-api-php\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codexworld.com\/get-latitude-longitude-from-address-using-google-maps-api-php\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/get-latitude-longitude-from-address-using-google-maps-api-php\/#primaryimage","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/03\/get-latitude-longitude-from-address-using-google-maps-geocoding-api-php-codexworld.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/03\/get-latitude-longitude-from-address-using-google-maps-geocoding-api-php-codexworld.png","width":1920,"height":1080,"caption":"get-latitude-longitude-from-address-using-google-maps-geocoding-api-php-codexworld"},{"@type":"BreadcrumbList","@id":"https:\/\/www.codexworld.com\/get-latitude-longitude-from-address-using-google-maps-api-php\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codexworld.com\/"},{"@type":"ListItem","position":2,"name":"Get Latitude and Longitude from Address with Google Maps API using PHP"}]},{"@type":"WebSite","@id":"https:\/\/www.codexworld.com\/#website","url":"https:\/\/www.codexworld.com\/","name":"CodexWorld","description":"Web &amp; Mobile App Development Company","publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codexworld.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codexworld.com\/#organization","name":"CodexWorld","url":"https:\/\/www.codexworld.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","width":200,"height":19,"caption":"CodexWorld"},"image":{"@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldweb","https:\/\/www.linkedin.com\/company\/codexworld","https:\/\/www.youtube.com\/codexworld"]},{"@type":"Person","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0","name":"CodexWorld","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","caption":"CodexWorld"},"description":"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.","sameAs":["http:\/\/www.codexworld.com","https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldblog"],"url":"https:\/\/www.codexworld.com\/author\/nitya192265\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/03\/get-latitude-longitude-from-address-using-google-maps-geocoding-api-php-codexworld.png","jetpack_shortlink":"https:\/\/wp.me\/p6bxIh-lq","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/1328","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/comments?post=1328"}],"version-history":[{"count":6,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/1328\/revisions"}],"predecessor-version":[{"id":5673,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/1328\/revisions\/5673"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media\/5533"}],"wp:attachment":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media?parent=1328"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/categories?post=1328"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/tags?post=1328"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}