<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>locationCoordinates &#8211; Best DevOps</title>
	<atom:link href="https://www.bestdevops.com/tag/locationcoordinates/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.bestdevops.com</link>
	<description>Lets Learn, Do it &#38; Share! Thats a Best DevOps!!!</description>
	<lastBuildDate>Thu, 05 Aug 2021 07:45:03 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.3</generator>
	<item>
		<title>Adding an Auto-Complete Address Field to your Forms (Laravel)</title>
		<link>https://www.bestdevops.com/adding-an-auto-complete-address-field-to-your-forms-laravel/</link>
		
		<dc:creator><![CDATA[pradeep]]></dc:creator>
		<pubDate>Thu, 05 Aug 2021 07:43:21 +0000</pubDate>
				<category><![CDATA[DevOps]]></category>
		<category><![CDATA[Laravel]]></category>
		<category><![CDATA[AutoComplete]]></category>
		<category><![CDATA[autoFetchAddress]]></category>
		<category><![CDATA[autofillAddress]]></category>
		<category><![CDATA[googleMapsPlace]]></category>
		<category><![CDATA[googlePlaceApi]]></category>
		<category><![CDATA[locationCoordinates]]></category>
		<guid isPermaLink="false">https://www.bestdevops.com/?p=18704</guid>

					<description><![CDATA[First of all we need to get a google maps API, go through this documentation to get an API of [&#8230;]]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="1024" height="403" src="https://www.bestdevops.com/wp-content/uploads/2021/08/croped-autoAddress-3-1024x403.png" alt="" class="wp-image-18710" srcset="https://www.bestdevops.com/wp-content/uploads/2021/08/croped-autoAddress-3-1024x403.png 1024w, https://www.bestdevops.com/wp-content/uploads/2021/08/croped-autoAddress-3-300x118.png 300w, https://www.bestdevops.com/wp-content/uploads/2021/08/croped-autoAddress-3-768x302.png 768w, https://www.bestdevops.com/wp-content/uploads/2021/08/croped-autoAddress-3.png 1167w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption>What we are building</figcaption></figure>



<h3 class="wp-block-heading"> First of all we need to get  a google maps API, go through this <a href="https://developers.google.com/maps/documentation/javascript/get-api-key">documentation </a>to get an API of your own.<br></h3>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="251" src="http://www.bestdevops.com/wp-content/uploads/2021/08/image-33-1024x251.png" alt="" class="wp-image-18692" srcset="https://www.bestdevops.com/wp-content/uploads/2021/08/image-33-1024x251.png 1024w, https://www.bestdevops.com/wp-content/uploads/2021/08/image-33-300x73.png 300w, https://www.bestdevops.com/wp-content/uploads/2021/08/image-33-768x188.png 768w, https://www.bestdevops.com/wp-content/uploads/2021/08/image-33.png 1307w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption>we need Geocoding API and Maps JavaScript API</figcaption></figure>



<h3 class="wp-block-heading">Next thing we need to do is to put a initializing script in our blade file </h3>


<pre class="wp-block-code"><span><code class="hljs language-xml"><span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&amp;callback=initAutocomplete&amp;libraries=places&amp;v=weekly"</span><span class="hljs-attr">async</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></span></pre>


<ul class="wp-block-list"><li>Make sure to provide your api key in the script </li></ul>



<p class="wp-block-paragraph">The above script will call a method name initAutocomplete that we have to write in our .js file </p>


<pre class="wp-block-code"><span><code class="hljs language-xml"><span class="hljs-tag">&lt;<span class="hljs-name">form</span>&gt;</span> 
   <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"row mt-3"</span>&gt;</span>
     <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"col-md-12"</span>&gt;</span>
       <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"address-input"</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"address1"</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"form-control"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">""</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"hidden"</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"address_latitude"</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"address-latitude"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">""</span> <span class="hljs-attr">required</span>/ &gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"hidden"</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"address_longitude"</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"address-longitude"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">""</span> <span class="hljs-attr">required</span>/&gt;</span>
     <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
   <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
   <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"btn btn-primary"</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"submit"</span>&gt;</span>Save Profile<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
 <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">form</span>&gt;</span></code></span></pre>


<ul class="wp-block-list"><li>Make sure you form have these matching selectors </li></ul>



<script src="https://gist.github.com/pradeeprjth/64fbf47b6a04f67b17dea57d2fd57ef2.js"></script>



<p class="wp-block-paragraph">What i have done in above code</p>



<ul class="wp-block-list"><li>In the above code the first method initAutocomplete() method is initializing by our script call-back </li><li>Next thing we are getting the input keywords in locationInput constant </li><li>Then with the help of geocoder we are manipulating our provided key word to form let long and</li><li>Next we initializing  <em>autocomplete = new </em>google.maps.places.Autocomplete(input); </li><li>At the end we are getting the provide address in our place variable </li><li>There is an another method setLocationCoordinates() i used this method to set let long so that I can store the co-ordinates along with the address in DB </li></ul>



<p class="wp-block-paragraph">That&#8217;s it, hope this help ;</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
