Skip to content

How to create a blue dot location marker? #552

Answered by ansoniikun
ansoniikun asked this question in Q&A
Discussion options

You must be logged in to vote

thank you

I managed to get what I needed like this

// GeolocationMarker.jsx
import React, { useEffect, useMemo } from "react";
import { useMap } from "@vis.gl/react-google-maps";

const GeolocationMarker = ({ position, accuracy }) => {
  const map = useMap();

  const geolocationMarker = useMemo(() => {
    if (!map) return null;

    const marker = new google.maps.Marker({
      position,
      map,
      icon: {
        path: google.maps.SymbolPath.CIRCLE,
        fillColor: "#4285F4",
        fillOpacity: 1,
        scale: 8,
        strokeColor: "#FFFFFF",
        strokeWeight: 2,
      },
    });

    return { marker };
  }, [map, position]);

  const accuracyCircle = useMemo(() => {…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by ansoniikun
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants