I am using react-google-maps
and I am able to display location based on lan
and lat
but I can not find any way to display location using shared link for example
https://goo.gl/maps/YBuwmbwH21yUE19Z9
I want to display this link in google map
Here is my code:
withGoogleMap(props => (
<GoogleMap
defaultZoom={17}
defaultCenter={{ lat: props.lat, lng: props.lng }}
>
{props.isMarkerShown && (
<Marker
clickable={true}
title={'asdasdads'}
position={{ lat: props.lat, lng: props.lng }}
/>
)}
</GoogleMap>
)),
);
const Location = ({ URL }) => {
var splitUrl = URL.split('!3d');
var latLong = splitUrl[splitUrl.length - 1].split('!4d');
var longitude;
if (latLong.indexOf('?') !== -1) {
longitude = latLong[1].split('\\?')[0];
} else {
longitude = latLong[1];
}
var latitude = latLong[0];
return (
<div
className={`box-dashboard d-flex justify-content-center align-items-center bg-white mb-4`}
>
<MyMapComponent
lat={parseFloat(latitude)}
lng={parseFloat(longitude)}
isMarkerShown
googleMapURL={`https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=geometry,drawing,places&key=${YOUR_GOOGLE_API_KEY}`}
loadingElement={<div style={{ height: `100%` }} />}
containerElement={<div style={{ height: `300px`, width: '100%' }} />}
mapElement={<div style={{ height: `100%` }} />}
/>
</div>
);
};
Please help me, Thanks you