flask-extensions / Flask-GoogleMaps

Easy way to add GoogleMaps to Flask applications. maintainer: @getcake
https://flask-googlemaps.com
MIT License
644 stars 195 forks source link

[bug] No data validation for lat and lng attributes #137

Closed bhuveshsharma09 closed 3 years ago

bhuveshsharma09 commented 3 years ago

Describe the bug If the value of lat is beyond -90 and +90 and lng is beyond -180 and +180 then the map will actually not display anything as the values will be invalid.

As an intelligent program, the program must raise an error message to notify the invalid input or should not accept such a value.

To Reproduce Put invalid lat and lng values while initializing a Map object. e.g. lat=91, lng=11,

image

JacobGeoGeek commented 3 years ago

I was wondering if this bug is only available when a user initializes the Map object ? Or we can also find this bug when someone adds a mark or a polygon.

bhuveshsharma09 commented 3 years ago

Hey @JacobGeoGeek, Yes it will affect while adding marker or shapes as well.

JacobGeoGeek commented 3 years ago

Good morning @bhuveshsharma09 (from Canada)

In this case, I should probably call the method (check the PR #138 for more detail ) for every property that handles a set of coordinates (ex: add a circle, create polygons ...).

I think it will be a good idea to mention this restriction on the README.md (so users are aware of the boundaries of lat long coordinates).

Thanks for the feedback. (FYI: I'm just starting to contribute to this repo.)

bhuveshsharma09 commented 3 years ago

Hello @JacobGeoGeek !

I think there is no need to call this method for other properties as in all other properties (like marker, shapes, etc.) the Map class is already being initialized (to form a Map object) which already invokes this method.

I saw the PR, great work. I locally have also developed a solution for this issue until the code merges.

Have a great day!

JacobGeoGeek commented 3 years ago

Hey @bhuveshsharma09 !

Correct if I am wrong: after looking at the constructor of the Map class (def __init__ (....)) I noticed that the constructor will call methods like self.build_something (ex: self.build_markers) in order to create the geometry form on the map.

Also, those methods take an array or a dictionary of lat, lng

With that, I do think that we need to validate each coordinates within those methods?

Cheers !

JacobGeoGeek commented 3 years ago

@Riverfount you should probably close this issue, since my PR was merged into the master branch

Riverfount commented 3 years ago

@JacobGeoGeek, pleas can you help me to admin these issues??

JacobGeoGeek commented 3 years ago

Hello @Riverfount and happy new year,

I can help you on some issues related this repo. However, I will probably not have a lot of time to check each one of them. Also, I'm not really an expert with the Flask framework. So, there will be a lot of learning periods in order to understand the mechanics behind this framework.

Have a good day, Jacob.