Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set extent of map using map_options #220

Open
dhirajshinde121083 opened this issue Apr 30, 2020 · 3 comments
Open

set extent of map using map_options #220

dhirajshinde121083 opened this issue Apr 30, 2020 · 3 comments

Comments

@dhirajshinde121083
Copy link

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
Copy link

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
Copy link
Author

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
Copy link
Author

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants