Google Maps API – Simple google map with draggable marker Example

Google Maps API – Simple google map with draggable marker Example

In this post we will give you information about Google Maps API – Simple google map with draggable marker Example. Hear we will give you detail about Google Maps API – Simple google map with draggable marker ExampleAnd how to use it also give you demo for it if it is necessary.

Hi Artisan,

Are you looking for simple map for your website, if yes then you are a right place. i will create simple google map with marker using google api. you are also simply able to get lat and long from google map marker. if you are developing with wordpress, php, laravel then also easily use.

You have to simple copy below code and paste on your website. Also you can see demo from below button.

Preview:

index.html

Also see:Google Maps API – Autocomplete Address Search Box with Map Example

<!DOCTYPE html>

<html>

<head>

<title>Google Maps API - Simple google map with draggable marker Example</title>

<style type="text/css">

#map {

width: 100%;

height: 400px;

}

</style>

</head>

<body>

<h1>Google Maps API - Simple google map with draggable marker Example</h1>

<div id="map"></div>

<ul id="geoData">

<li>Latitude: <span id="lat-span"></span></li>

<li>Longitude: <span id="lon-span"></span></li>

</ul>

<script>

function initMap() {

var myLatLng = {lat: 22.3038945, lng: 70.80215989999999};

var map = new google.maps.Map(document.getElementById('map'), {

center: myLatLng,

zoom: 13

});

var marker = new google.maps.Marker({

position: myLatLng,

map: map,

title: 'Hello World!',

draggable: true

});

google.maps.event.addListener(marker, 'dragend', function(marker) {

var latLng = marker.latLng;

document.getElementById('lat-span').innerHTML = latLng.lat();

document.getElementById('lon-span').innerHTML = latLng.lng();

});

}

</script>

<script src="https://maps.googleapis.com/maps/api/js?libraries=places&callback=initMap" async defer></script>

</body>

</html>

I hope it can help you…

Hope this code and post will helped you for implement Google Maps API – Simple google map with draggable marker Example. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

Your email address will not be published. Required fields are marked *

77  +    =  78

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US