GithubHelp home page GithubHelp logo

frojd / wagtail-geo-widget Goto Github PK

View Code? Open in Web Editor NEW
133.0 8.0 38.0 936 KB

Wagtail-Geo-Widget is the complete map solution for your Wagtail site.

License: MIT License

Python 71.27% CSS 0.37% JavaScript 23.25% Shell 0.69% HTML 3.88% Dockerfile 0.50% Makefile 0.04%
wagtail google-maps geodjango leaflet open-street-map

wagtail-geo-widget's Introduction

Run tests, lint and publish PyPI version

Wagtail-Geo-Widget

Wagtail-Geo-Widget is the complete map solution for your Wagtail site.

Screen1

Features

  • Supports Google Maps or any tile provider supported by Leaflet (such as Open Street Map or Mapbox)
  • Real spatial support (with GeoDjango and PointField)
  • Storing coordinates as strings (for no-GeoDjango setups)
  • StreamField integration
  • Searching with geocoding (supports Google Geocoding, Nominatim and Mapbox)
  • Inline panel support
  • Optional address search field
  • Language support

Documentation

Contribute

If you have ideas for improvement, please share your thoughts through an issue.

We also welcome Pull Requests (PR). Please note that this project uses git-flow so please use the develop branch when creating PR's.

Security

If you believe you have found a security issue with any of our projects please email us at [email protected].

License

Wagtail-Geo-Widget is released under the MIT License.

wagtail-geo-widget's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar eduardocp avatar flipperpa avatar hikari avatar jamielennox avatar jwayodi avatar kleingeist avatar marteinn avatar nickhudkins avatar pmontepagano avatar pytsh avatar rinti avatar solarissmoke avatar tasosalvas avatar thbtsprt avatar thibaudcolas avatar tomdyson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wagtail-geo-widget's Issues

Django 1.11 compatibility

I just updated to Django 1.11.1 (from 1.10.7) and although the project and the geo widget was working fine before, it now complain on startup about:

django.contrib.gis.gdal.error.GDALException: Could not find the GDAL library (tried "gdal", "GDAL", "gdal1.11.0", "gdal1.10.0", "gdal1.9.0", "gdal1.8.0", "gdal1.7.0"). Try setting GDAL_LIBRARY_PATH in your settings.

The problem arises on startup while importing the GeoPanel in my homepage model.
I dont think i actually need GDAL (and dont want to install it) since it works fine when downgrading Django again, but something changed resulting in the need of GDAL in the new Django version. Do you know what happened? Is it actually caused by the geo widget or did some Django internals change so that i actually need to install GDAL tho im not using it?

Make it possible to have an empty location field as default

Usecase
We have a site where some articles have coordinates, and some articles do not have coordinates - however - every article should have the possibility to add them.

Problem
Every article that gets saved gets the default coordinates, which isn't optimal when we add the articles to a google map.

Solution
I'm thinking if we have a new setting like GEO_WIDGET_LOCATION_START_EMPTY = True, then leave the location field empty until the location field or the address field gets focussed, then set it to the default from GEO_WIDGET_DEFAULT_LOCATION.
I feel like this might feel like a really weird interaction though, so not sure how to solve this properly, since the pin is needed.

Another option would be to have the input hidden and a button "Set pin", which then shows the location field with the default coordinates.

GoogleMapsPanel doesn't correctly parse the passed in address_field

class GoogleMapsPanel(FieldPanel):

I've not had time to dig very deeply into the issue but I think it's because the recent work to add Wagtail compatibility has broken it.

If get time I will take a look. This part of the upgrade docs is the relevant info: https://docs.wagtail.org/en/stable/releases/3.0.html#api-changes-to-panels-edithandlers

It may be as simple as renaming this function:

def widget_overrides(self):
as I think above where
opts["widgets"] = self.widget_overrides()

Is not using the function below but the function on the parent Panel class which returns and empty dict. I am guessing though.

Can wagtail-geo-widget support more complex geometry?

I'm writing a replacement for the map tool my university uses, since we're moving from Drupal to Wagtail, and we need to be able to draw complex polygons, including those with holes in them, for individual buildings. Can this widget, perhaps with heavy modifications by myself, be made to store and display such data? Or do you think I'd have to start entirely from scratch?

If I can build on top of this project to accomplish my goals, I'd be happy to offer my changes as a PR. However, we use purely GeoJSON for our existing map data, so I don't think we'll be using any of the GIS or GeoDjango stuff that's already in place in this library.

pip installs develop branch?

couldn't follow the docs after installation because wagtailgeowidget.panels was raising an error. did a bit of research and it seems to me that pip installs the develop branch which uses wagtailgeowidgets.edit_handlers.

this seems confusing to me, is this intentional?

Translate strings

There are currently plenty of text that are untranslated (only in English), lets make sure all user facing strings are translated.

address field not rendered

Hi! I was following the readme, but the GeoPanel stops working when i add the address field to its definition. In the admin the address field will not be displayed and changes to the location will not be saved. There is no obvious error i could report - everything look fine apart from the missing input field.
Django 1.10.7 and wagtail 1.9.1

GEO_WIDGET_ZOOM not working

I have defined GEO_WIDGET_ZOOM to 15 on settings but the map not respect it.

I belive it's becouse the file edit_handlers.py on line 21 no call the constant.

Custom template tag for render in templates

Hi!

Is a very good work that you did here.

I want ask for template tag, i think, the complete package should have a rendering template tag for templates.

Some like {% gmap 'localtion | address' size zoom %}, etc.

I'm trying making one but is hard for me.

Can you add this feature please?

Reverse geocoding

With wagtail==4.0.4 and wagtailgeowidget==6.2.0, I have setup linked address and position fields as in the docs, and tested with both Google Maps and Leaflet + Nominatim.

When I change the address, the pin moves on the map as expected.

However, if I move the pin, the address does not update. Is it supposed to, ie. is reverse geocoding supported?

If it isn't, it would be great to have an option to either prevent the user from moving the pin (so the map would just be a 'read-only' confirmation of the address), or to empty the address field if the pin is moved - so as to prevent situations where the address and position are out of sync.

Cannot geocode on production

When i run the service on my laptop/dev enviroment it works just fine. However when I deploy it on my production Debian server it shows the following error when typing in an address in a warning box just below the input.

"Could not geocode address "a". The map may not be in sync with the address entered."

When i check the console i get the following error.

Geocoding Service: This API project is not authorized to use this API.
For more information on authentication and Google Maps JavaScript API services please see: https://developers.google.com/maps/documentation/javascript/get-api-key

The strange part is, the map displays so it partially works.

They are both running same setup

  1. Django 2.0.9
  2. Wagtail 2.1.3
  3. Python 3.4.2

image
or sometimes it shows this pop up

image

Admin Configurable Settings.

In CMS, we expect to configure less from the developer's end.
Instead of setting the variables in the settings, let's put this in a settings model so that the user can change them without developers getting involved.

Failed to pip install with python3

pip install wagtailgeowidget==4.0.2

Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-install-mb8vp6hq/wagtailgeowidget/setup.py", line 10, in <module> from pip.req import parse_requirements ModuleNotFoundError: No module named 'pip.req'

This seems to happend with pip 10
See here for a possible solution

Set zoom level dynamically from a GeoPanel

Currently it's possible to zoom in and out the map widget, but after you save the map and open it again for edit, last zoom level in the map widget is not preserved but instead the hardcoded zoom level is used (either from settings or GeoPanel(zoom=...)).

What I need is to set the zoom level dynamically for each map, so that different maps can use different zoom levels. When I save the map, I want to read the "zoom" from map widget and store it to the database for the map. When the map is opened for edit, GeoPanel should read "zoom" from the database and initialise the widget with that zoom level instead of the default one. Optionally, there could be also "zoom" field shown in the edit page if user wants to set it via text input instead of using the map.

GEO_WIDGET_DEFAULT_LOCATION without touching the field returns None

Expected result would be that GEO_WIDGET_DEFAULT_LOCATION are set.

Description from user:

I just had to manually set the default location, by overriding the save method. I tried to set:GEO_WIDGET_DEFAULT_LOCATION = {'lat': 45.070312, 'lng': 7.6868565}  but when I save the model without touching the location, the location field is set to None (maybe I did something wrong, but with 3 lines of code in the save model I solved the problem).

Problem with GEO Django library.

I have this problem:
seleccion_308

THis happend after i save the field. I didn't add the setting because i don't need it, i only want put the address and see the map, no more.

Field and Stream Block works fine before save de field, but after it, when page is reloaded, or accessed again, i get this error.

I found this documentation.

What can i do?

Will this awesome widget have template rendering?

Thank you for making this widget, it replaced me whole lot of other half-working options. But I did not find a way how to render map inside template, for now I have a custom inclusion tag to render the map.

Could you please make a wagtailgeowidget_tags or something?

Allow for configurable default value

It seems the only way to change the default map right now is by passing along a default value to the model field. In some cases it's preferable to not have a default so you can keep it blank.

GeoPanel inside InlinePanel

When the GeoPanel is used inside an InlinePanel it is not rendered and it breaks the inlinepanel behaviour.
screen shot 2017-03-21 at 12 58 12

Compatibility with PIP > 10.0

Seems like it could be an easy fix.

Error reported under pip 18

Collecting wagtailgeowidget==4.0.2 (from -r ../config/requirements.txt (line 10))
Downloading https://files.pythonhosted.org/packages/47/b8/88c3a750e1e891506b468a9688e7a09f74afc994cec5af3e7b5a5612c450/wagtailgeowidget-4.0.2.tar.g
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "/tmp/pip-install-q0y9jw7k/wagtailgeowidget/setup.py", line 10, in <module>
        from pip.req import parse_requirements
ModuleNotFoundError: No module named 'pip.req'

Thank you!!

Multiple markers

I did not see it in the documentation, is it possible to add multiple markers?

The geos_ptrn should allow minus as well

Using the Google Maps API, some location might have negative longitude. The geos_ptrn will fail in that case and map won't reflect the real coordinates.

I think that something like that, might do it:

geos_ptrn = re.compile(
"^SRID=([0-9]{1,});POINT(([0-9.-]{1,})\s([0-9.-]{1,}))$"
)

Widget not rendering in Wagtail 3.0, but works in Wagtail 2.16.2.

It seems the widget is not working correctly in Wagtail 3.0. I have tested the basic setup for both 3.0 and 2.16.2, and it does not render properly at 3.0, but works fine for 2.16.2 version.

Notice the difference between placeholder values in the fields, they're missing in 3.0.

Wagtail 3.0
3-0

Wagtail 2.16.2
2-16-2

class MapTestPage(Page):
    map_address = CharField(max_length=250, blank=True, null=True)
    map_location = CharField(max_length=250, blank=True, null=True)
    map_zoom = SmallIntegerField(blank=True, null=True)

    content_panels = Page.content_panels + [
        MultiFieldPanel([
            GeoAddressPanel('map_address', geocoder=GOOGLE_MAPS),
            GoogleMapsPanel('map_location', address_field='map_address', zoom_field='map_zoom'),
            FieldPanel('map_zoom'),
        ], 'Location'),
    ]

Fake function in documentation

Hi man, all is well, but you have a big problem here: parse_geosgeometry_string.

This function doesn't exist, i get this problem:
seleccion_309

So, viewing if something is wrong i found that these function doesn't exist.

I think you have to change documentation.

PD: Which the difference between spatial and nonspatial examples?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.