jazzband / django-floppyforms

Full control of form rendering in the templates.
http://django-floppyforms.readthedocs.org/
Other
841 stars 148 forks source link

set extent of map using map_options #220

Open dhirajshinde121083 opened 4 years ago

dhirajshinde121083 commented 4 years ago

i am trying to draw polygon on using floppy-form map in geodjango is there a way by which i can restrict user to draw polygon in certain restricted area using map_options

in short i want to know how so i set map boundaries extent using JavaScript code for floppy form i know there is option for that in geodjango floppyform : "map_options"

but i don't know how do i set that can someone help me ?

JackAtOmenApps commented 4 years ago

There's an example further down in the docs showing hot to limit the map extent:

{% block map_options %}
var map_options = {
    maxExtend: new OpenLayers.Bounds(-20037508,-20037508,20037508,20037508),
    maxResolution: 156543.0339,
    numZoomLevels: 20,
    units: 'm'
};
{% endblock %}
dhirajshinde121083 commented 4 years ago

Yes i know this, this allows us to set boundaries of rectangular shape, what if i want to set polygon shape boundaries, is there a way to restrict user to draw geometry within other polygon bounderies limit
e. g I have area called "xyz" which is polygon in shape, which lies inside a city called "abc" which is also polygon, so in short i want to draw "xyz" inside "abc", so there will be dropdown in my form which will have city option which contain "abc" as one of the option on select of which it restrict user to draw area of "xyz" on map within "abc" city boundaries. is it possible ?

dhirajshinde121083 commented 4 years ago

There's an example further down in the docs showing hot to limit the map extent:


{% block map_options %}
var map_options = {
    maxExtend: new OpenLayers.Bounds(-20037508,-20037508,20037508,20037508),
    maxResolution: 156543.0339,
    numZoomLevels: 20,
    units: 'm'
};
{% endblock %}
``` what if i want to set polygon shape boundaries, is there a way to restrict user to draw geometry within other polygon bounderies limit
e. g
I have area called "xyz" which is polygon in shape, which lies inside a city called "abc" which is also polygon, so in short i want to draw "xyz" inside "abc", so there will be dropdown in my form which will have city option which contain "abc" as one of the option on select of which it restrict user to draw area of "xyz" on map within "abc" city boundaries.
is it possible ?