2

I suppose to save the drawn shapes and on-demand it should load into the map. When I draw point and circle it gives same geoJSON. Type of both the shapes are point. I can't able to differentiate the difference. When I load the circle geoJSON to the map, it is loading as point.

demo

Checkout the console log from the screenshot.

leaflet

Is't a bug or I'm doing something wrong? Please advice.

Premkumar Jayaseelan
  • 681
  • 2
  • 10
  • 30

2 Answers2

2

GeoJSON doesn't support circles. It's doing the best it can with the point. I got around it by storing the radius as a property of the feature

Founder
  • 626
  • 6
  • 19
1

They are the same, because they can be represented with the same information but symbolized differently.

Think of the following: what is the GeoJSON representation of a blue line vs a red line? They are the same, but one is symbolized in blue and the other is symbolized in red.

The same applies to points: you can symbolize a point with a blue circle, or a yellow square, or a blue arrow, or a word. Their data model is the same, their symbolization is different.

IvanSanchez
  • 18,272
  • 3
  • 30
  • 45
  • I've problem while saving the GeoJSON. In map we can show as you suggested. But once you saved and retrieve it back. How to differentiate? Bze geometry type of both is `Point`, How can I identity that, this is `circle` and `point`. – Premkumar Jayaseelan Jun 28 '16 at 09:43
  • You're using `layer.asGeoJSON()`. Use things like `layer instanceof L.Point` and access `layer.options`. – IvanSanchez Jun 28 '16 at 09:59