Drawing a circle around a point in vue2-google-maps












1















I am using Vue to build a site that takes in some data and displays a google map with markers and circles around the points with the markers.



So far I can create the map with markers perfectly fine, however I have no idea what the proper way to create a circle is with the Vue2-google-maps package, despite having combed through the Documentation for a long time.



Here is the code so far



    <GmapMap
:center="center"
:zoom="10"
class="google-map">
<GmapMarker
:key="index"
v-for="(pin, index) in markers"
:position="pin.position"
:icon="pin.icon"
:clickable="true"
:draggable="true"
@click="center=pin.position">
</GmapMarker>
<GmapCircle
:key="index"
v-for="(pin, index) in markers"
:center="pin.position"
:radius="1000"
:visible="true"
:fillColor="red"
:fillOpacity:="1.0">
</GmapCircle>
</GmapMap>


Note that markers is a list of markers that is created somewhere else in the code.



If you take out the tags, the code works perfectly fine placing all the markers. I just need to know what the proper tag/object set is for creating a circle.










share|improve this question



























    1















    I am using Vue to build a site that takes in some data and displays a google map with markers and circles around the points with the markers.



    So far I can create the map with markers perfectly fine, however I have no idea what the proper way to create a circle is with the Vue2-google-maps package, despite having combed through the Documentation for a long time.



    Here is the code so far



        <GmapMap
    :center="center"
    :zoom="10"
    class="google-map">
    <GmapMarker
    :key="index"
    v-for="(pin, index) in markers"
    :position="pin.position"
    :icon="pin.icon"
    :clickable="true"
    :draggable="true"
    @click="center=pin.position">
    </GmapMarker>
    <GmapCircle
    :key="index"
    v-for="(pin, index) in markers"
    :center="pin.position"
    :radius="1000"
    :visible="true"
    :fillColor="red"
    :fillOpacity:="1.0">
    </GmapCircle>
    </GmapMap>


    Note that markers is a list of markers that is created somewhere else in the code.



    If you take out the tags, the code works perfectly fine placing all the markers. I just need to know what the proper tag/object set is for creating a circle.










    share|improve this question

























      1












      1








      1


      0






      I am using Vue to build a site that takes in some data and displays a google map with markers and circles around the points with the markers.



      So far I can create the map with markers perfectly fine, however I have no idea what the proper way to create a circle is with the Vue2-google-maps package, despite having combed through the Documentation for a long time.



      Here is the code so far



          <GmapMap
      :center="center"
      :zoom="10"
      class="google-map">
      <GmapMarker
      :key="index"
      v-for="(pin, index) in markers"
      :position="pin.position"
      :icon="pin.icon"
      :clickable="true"
      :draggable="true"
      @click="center=pin.position">
      </GmapMarker>
      <GmapCircle
      :key="index"
      v-for="(pin, index) in markers"
      :center="pin.position"
      :radius="1000"
      :visible="true"
      :fillColor="red"
      :fillOpacity:="1.0">
      </GmapCircle>
      </GmapMap>


      Note that markers is a list of markers that is created somewhere else in the code.



      If you take out the tags, the code works perfectly fine placing all the markers. I just need to know what the proper tag/object set is for creating a circle.










      share|improve this question














      I am using Vue to build a site that takes in some data and displays a google map with markers and circles around the points with the markers.



      So far I can create the map with markers perfectly fine, however I have no idea what the proper way to create a circle is with the Vue2-google-maps package, despite having combed through the Documentation for a long time.



      Here is the code so far



          <GmapMap
      :center="center"
      :zoom="10"
      class="google-map">
      <GmapMarker
      :key="index"
      v-for="(pin, index) in markers"
      :position="pin.position"
      :icon="pin.icon"
      :clickable="true"
      :draggable="true"
      @click="center=pin.position">
      </GmapMarker>
      <GmapCircle
      :key="index"
      v-for="(pin, index) in markers"
      :center="pin.position"
      :radius="1000"
      :visible="true"
      :fillColor="red"
      :fillOpacity:="1.0">
      </GmapCircle>
      </GmapMap>


      Note that markers is a list of markers that is created somewhere else in the code.



      If you take out the tags, the code works perfectly fine placing all the markers. I just need to know what the proper tag/object set is for creating a circle.







      javascript google-maps vue.js vuejs2 vue2-google-maps






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 2 at 17:52









      wjmccannwjmccann

      31518




      31518
























          1 Answer
          1






          active

          oldest

          votes


















          1














          You are on the right track, GmapCircle component in vue2-google-maps library is intended for creating circles on the map. There are might be several reasons why circles are not getting displayed:





          • center property value is invalid, the supported format is {lat: <lat>, lng: <lng>} or google.maps.LatLng value

          • maybe you could not spot them due to relatively small size (given the provided 2 kilometer diameter, they could be easily missed)?


          Regarding fillColor and fillOpacity properties, they need to be passed via options property, e.g. :options="{fillColor:'red',fillOpacity:1.0}"



          Anyway the following example demonstrates how to create circles on map via vue2-google-maps



          <GmapMap :center="center" :zoom="zoom" ref="map">
          <GmapCircle
          v-for="(pin, index) in markers"
          :key="index"
          :center="pin.position"
          :radius="100000"
          :visible="true"
          :options="{fillColor:'red',fillOpacity:1.0}"
          ></GmapCircle>
          </GmapMap>



          export default {
          data() {
          return {
          zoom: 5,
          center: { lat: 59.339025, lng: 18.065818 },
          markers: [
          { Id: 1, name: "Oslo", position: { lat: 59.923043, lng: 10.752839 } },
          { Id: 2, name: "Stockholm", position: { lat: 59.339025, lng: 18.065818 } },
          { Id: 3, name: "Copenhagen", position: { lat: 55.675507, lng: 12.574227 }},
          { Id: 4, name: "Berlin", position: { lat: 52.521248, lng: 13.399038 } },
          { Id: 5, name: "Paris", position: { lat: 48.856127, lng: 2.346525 } }
          ]
          };
          },
          methods: {}
          };





          share|improve this answer



















          • 1





            Thank you! Worked like a charm!

            – wjmccann
            Jan 2 at 20:54











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54010929%2fdrawing-a-circle-around-a-point-in-vue2-google-maps%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          You are on the right track, GmapCircle component in vue2-google-maps library is intended for creating circles on the map. There are might be several reasons why circles are not getting displayed:





          • center property value is invalid, the supported format is {lat: <lat>, lng: <lng>} or google.maps.LatLng value

          • maybe you could not spot them due to relatively small size (given the provided 2 kilometer diameter, they could be easily missed)?


          Regarding fillColor and fillOpacity properties, they need to be passed via options property, e.g. :options="{fillColor:'red',fillOpacity:1.0}"



          Anyway the following example demonstrates how to create circles on map via vue2-google-maps



          <GmapMap :center="center" :zoom="zoom" ref="map">
          <GmapCircle
          v-for="(pin, index) in markers"
          :key="index"
          :center="pin.position"
          :radius="100000"
          :visible="true"
          :options="{fillColor:'red',fillOpacity:1.0}"
          ></GmapCircle>
          </GmapMap>



          export default {
          data() {
          return {
          zoom: 5,
          center: { lat: 59.339025, lng: 18.065818 },
          markers: [
          { Id: 1, name: "Oslo", position: { lat: 59.923043, lng: 10.752839 } },
          { Id: 2, name: "Stockholm", position: { lat: 59.339025, lng: 18.065818 } },
          { Id: 3, name: "Copenhagen", position: { lat: 55.675507, lng: 12.574227 }},
          { Id: 4, name: "Berlin", position: { lat: 52.521248, lng: 13.399038 } },
          { Id: 5, name: "Paris", position: { lat: 48.856127, lng: 2.346525 } }
          ]
          };
          },
          methods: {}
          };





          share|improve this answer



















          • 1





            Thank you! Worked like a charm!

            – wjmccann
            Jan 2 at 20:54
















          1














          You are on the right track, GmapCircle component in vue2-google-maps library is intended for creating circles on the map. There are might be several reasons why circles are not getting displayed:





          • center property value is invalid, the supported format is {lat: <lat>, lng: <lng>} or google.maps.LatLng value

          • maybe you could not spot them due to relatively small size (given the provided 2 kilometer diameter, they could be easily missed)?


          Regarding fillColor and fillOpacity properties, they need to be passed via options property, e.g. :options="{fillColor:'red',fillOpacity:1.0}"



          Anyway the following example demonstrates how to create circles on map via vue2-google-maps



          <GmapMap :center="center" :zoom="zoom" ref="map">
          <GmapCircle
          v-for="(pin, index) in markers"
          :key="index"
          :center="pin.position"
          :radius="100000"
          :visible="true"
          :options="{fillColor:'red',fillOpacity:1.0}"
          ></GmapCircle>
          </GmapMap>



          export default {
          data() {
          return {
          zoom: 5,
          center: { lat: 59.339025, lng: 18.065818 },
          markers: [
          { Id: 1, name: "Oslo", position: { lat: 59.923043, lng: 10.752839 } },
          { Id: 2, name: "Stockholm", position: { lat: 59.339025, lng: 18.065818 } },
          { Id: 3, name: "Copenhagen", position: { lat: 55.675507, lng: 12.574227 }},
          { Id: 4, name: "Berlin", position: { lat: 52.521248, lng: 13.399038 } },
          { Id: 5, name: "Paris", position: { lat: 48.856127, lng: 2.346525 } }
          ]
          };
          },
          methods: {}
          };





          share|improve this answer



















          • 1





            Thank you! Worked like a charm!

            – wjmccann
            Jan 2 at 20:54














          1












          1








          1







          You are on the right track, GmapCircle component in vue2-google-maps library is intended for creating circles on the map. There are might be several reasons why circles are not getting displayed:





          • center property value is invalid, the supported format is {lat: <lat>, lng: <lng>} or google.maps.LatLng value

          • maybe you could not spot them due to relatively small size (given the provided 2 kilometer diameter, they could be easily missed)?


          Regarding fillColor and fillOpacity properties, they need to be passed via options property, e.g. :options="{fillColor:'red',fillOpacity:1.0}"



          Anyway the following example demonstrates how to create circles on map via vue2-google-maps



          <GmapMap :center="center" :zoom="zoom" ref="map">
          <GmapCircle
          v-for="(pin, index) in markers"
          :key="index"
          :center="pin.position"
          :radius="100000"
          :visible="true"
          :options="{fillColor:'red',fillOpacity:1.0}"
          ></GmapCircle>
          </GmapMap>



          export default {
          data() {
          return {
          zoom: 5,
          center: { lat: 59.339025, lng: 18.065818 },
          markers: [
          { Id: 1, name: "Oslo", position: { lat: 59.923043, lng: 10.752839 } },
          { Id: 2, name: "Stockholm", position: { lat: 59.339025, lng: 18.065818 } },
          { Id: 3, name: "Copenhagen", position: { lat: 55.675507, lng: 12.574227 }},
          { Id: 4, name: "Berlin", position: { lat: 52.521248, lng: 13.399038 } },
          { Id: 5, name: "Paris", position: { lat: 48.856127, lng: 2.346525 } }
          ]
          };
          },
          methods: {}
          };





          share|improve this answer













          You are on the right track, GmapCircle component in vue2-google-maps library is intended for creating circles on the map. There are might be several reasons why circles are not getting displayed:





          • center property value is invalid, the supported format is {lat: <lat>, lng: <lng>} or google.maps.LatLng value

          • maybe you could not spot them due to relatively small size (given the provided 2 kilometer diameter, they could be easily missed)?


          Regarding fillColor and fillOpacity properties, they need to be passed via options property, e.g. :options="{fillColor:'red',fillOpacity:1.0}"



          Anyway the following example demonstrates how to create circles on map via vue2-google-maps



          <GmapMap :center="center" :zoom="zoom" ref="map">
          <GmapCircle
          v-for="(pin, index) in markers"
          :key="index"
          :center="pin.position"
          :radius="100000"
          :visible="true"
          :options="{fillColor:'red',fillOpacity:1.0}"
          ></GmapCircle>
          </GmapMap>



          export default {
          data() {
          return {
          zoom: 5,
          center: { lat: 59.339025, lng: 18.065818 },
          markers: [
          { Id: 1, name: "Oslo", position: { lat: 59.923043, lng: 10.752839 } },
          { Id: 2, name: "Stockholm", position: { lat: 59.339025, lng: 18.065818 } },
          { Id: 3, name: "Copenhagen", position: { lat: 55.675507, lng: 12.574227 }},
          { Id: 4, name: "Berlin", position: { lat: 52.521248, lng: 13.399038 } },
          { Id: 5, name: "Paris", position: { lat: 48.856127, lng: 2.346525 } }
          ]
          };
          },
          methods: {}
          };






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 2 at 20:39









          Vadim GremyachevVadim Gremyachev

          37k773115




          37k773115








          • 1





            Thank you! Worked like a charm!

            – wjmccann
            Jan 2 at 20:54














          • 1





            Thank you! Worked like a charm!

            – wjmccann
            Jan 2 at 20:54








          1




          1





          Thank you! Worked like a charm!

          – wjmccann
          Jan 2 at 20:54





          Thank you! Worked like a charm!

          – wjmccann
          Jan 2 at 20:54




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54010929%2fdrawing-a-circle-around-a-point-in-vue2-google-maps%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Mossoró

          Error while reading .h5 file using the rhdf5 package in R

          Pushsharp Apns notification error: 'InvalidToken'