Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8672247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:09:21+00:00 2026-06-12T19:09:21+00:00

In the documentation for Leaflet here: http://leafletjs.com/reference-1.2.0.html#circlemarker it says that CircleMaker extends Circle, and

  • 0

In the documentation for Leaflet here: http://leafletjs.com/reference-1.2.0.html#circlemarker it says that CircleMaker extends Circle, and that it is the same thing, except the radius is specified in pixels rather than in meters, so that the circles stay constant size even if you zoom the map.

I do however need Circles, because I am trying to draw 100m radius circles on a map. To do this, I use the following code:

var geojsonLayer = new L.GeoJSON(null,{
pointToLayer: function (latlng){
    return new L.CircleMarker(latlng, {
        radius: 5,
        fillColor: "#ff7800",
        color: "#000",
        weight: 1,
        opacity: 1,
        fillOpacity: 0.8,
    });
}});

map.addLayer(osm);
map.addLayer(geojsonLayer);
geojsonLayer.addGeoJSON(jsonExample);

This works perfectly, however, if I change the code to use “Circle” instead of CircleMaker the entire map fails to load, and I get a javascript error:

Error: Error: Invalid LatLng object: (56.229917, NaN)

I can fix this by pre-filtering the geojson to remove those points which lack both latitude and longitude, but I’m confused: Circle and CircleMaker both specify that they take a LatLng-object as the specification of the center-point, I don’t get how a certain LatLng object can be valid as centre-point for a CircleMarker, but invalid if used as the centerpoint for a Circle.

Am I overlooking something obvious, or is this just a weakness and/or bug in Leaflet that I’ll just have to work around ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T19:09:22+00:00Added an answer on June 12, 2026 at 7:09 pm

    I fixed this by changing the _getLngRadius() method of leaflet.js in L.circle. In leaflet version 0.4.4, it’s around line 4913.

    This method differs from the one in circleMarker, as it computes the radius of the circle dynamically. If you change the line that has

    this._mRadius/hLength

    to

    this._mRadius.radius/hLength

    it should be ok.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Documentation states that 'handleResponseEnd' is called when the response has been completely received. http://twistedmatrix.com/documents/11.0.0/api/twisted.web.http.HTTPClient.html#handleResponseEnd
The documentation shows - http://google-maps-utility-library-v3.googlecode.com/svn/tags/keydragzoom/1.0/docs/examples.html function init(){ var myOptions = { zoom: 13, center:
The documentation of System.Threading.Timer says that I should keep a live reference for it
Documentation says that waypoints limit is 8 points. But I have to calculate a
The documentation for the node-mongo-native collection.find() function says that it creates a cursor object
The documentation says that the error() signal will be emitted if the child process
The documentation says that the ValidatorFactory is thread-safe, but I have a concern about
The documentation for the keyword is states that: The is operator only considers reference
The documentation says that the cartesian product function the actual implementation does not build
Various documentation such as http://confluence.atlassian.com/display/BITBUCKET/Set+up+SSH+for+Git and http://help.github.com/ssh-key-passphrases/ Refer to restarting git bash. How do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.