markush / django-osm-field Goto Github PK
View Code? Open in Web Editor NEWHome Page: http://markush.github.io/django-osm-field
License: MIT License
Home Page: http://markush.github.io/django-osm-field
License: MIT License
To reproduce: paste any decimal degrees coordinates under which there are no objects in OSM to the location field. 49.415248, 26.957707
for example.
Expected result: pointer put directly on these coordinates.
Actual result: pointer put on the nearest object (road, town) that can be several kilometres away.
I think it should be addressed in the django-osm-field
because Nominatim's function is just different.
And _lat, _lon fields changes are ignored on the map in my case, is that a bug?
Hi Marcus,
I am working on a project with Django 1.7.1 (Python 2.7.8, PostgreSQL 9.3.5) and the model contains the OSMField:
...
location = OSMField(verbose_name=_('Location'))
....
When running
$ ./manage.py makemigrations appointments
$ ./manage.py migrate appointments
it fails with
Operations to perform:
Apply all migrations: appointments
Running migrations:
Applying appointments.0001_initial...Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/sinn/foo/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/home/sinn/foo/lib/python2.7/site-packages/django/core/management/__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/sinn/foo/lib/python2.7/site-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/sinn/foo/lib/python2.7/site-packages/django/core/management/base.py", line 338, in execute
output = self.handle(*args, **options)
File "/home/sinn/foo/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 160, in handle
executor.migrate(targets, plan, fake=options.get("fake", False))
File "/home/sinn/foo/lib/python2.7/site-packages/django/db/migrations/executor.py", line 63, in migrate
self.apply_migration(migration, fake=fake)
File "/home/sinn/foo/lib/python2.7/site-packages/django/db/migrations/executor.py", line 97, in apply_migration
migration.apply(project_state, schema_editor)
File "/home/sinn/foo/lib/python2.7/site-packages/django/db/migrations/migration.py", line 107, in apply
operation.database_forwards(self.app_label, schema_editor, project_state, new_state)
File "/home/sinn/foo/lib/python2.7/site-packages/django/db/migrations/operations/models.py", line 36, in database_forwards
schema_editor.create_model(model)
File "/home/sinn/foo/lib/python2.7/site-packages/django/db/backends/schema.py", line 263, in create_model
self.execute(sql, params)
File "/home/sinn/foo/lib/python2.7/site-packages/django/db/backends/schema.py", line 99, in execute
cursor.execute(sql, params)
File "/home/sinn/foo/lib/python2.7/site-packages/django/db/backends/utils.py", line 81, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/home/sinn/foo/lib/python2.7/site-packages/django/db/backends/utils.py", line 65, in execute
return self.cursor.execute(sql, params)
File "/home/sinn/start-green/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/sinn/foo/lib/python2.7/site-packages/django/db/backends/utils.py", line 65, in execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: column "location_lat" specified more than once
Do you have an idea what might be wrong?
Can't seem to attach text files, hence a link to the migration file:
http://paste.awesom.eu/Yzpm
AFAIU validation gets in the way, django-import-export/django-import-export#284
How i add custom div to hold a full map not default auto hide.
This is the HTML generated by OSMField when it's in a formset:
<input class="form-control osmfield osmfield-input" data-lat-field="latitude" data-lon-field="longitude" id="id_times-1-location" name="times-1-location" placeholder="Location" prefix="times-1" title="" type="text">
<!-- These are used to target other inputs ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -->
<script type="application/javascript">$(function(){$("#id_times-1-location").osmfield();});</script>
<input id="id_times-1-latitude" name="times-1-latitude" type="hidden">
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^ should target this -->
<input id="id_times-1-longitude" name="times-1-longitude" type="hidden">
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^ should target this -->
As you can see, data-lat-field
refers to #latitude
, but there's no #latitude
id on the page, there's an id_times-1-latitude
id, which is what it should be targeting.
There needs to be a way to add the form's prefix attribute to the data-lat-field
and data-lon-field
attributes of the OSMField.
Hi, when I try to use this in admin panel, with plain django 1.8 - it works fine.
But when we add some admin packages, like django-easy-select2 which uses jquery as well, then this package fails to start, and firebug shows:
TypeError: $(...).osmfield is not a function
I fixed issue by replacing line in osm_field.(min)?.js
from
(function($) {
into
jQuery(document).ready(function(jQuery) {
and removing
(jQuery)
from the last line.
Not sure it's a good approach, but it works at least ;-)
Apparently, MapQuest removed the tiles support. We should replace that with CartoDB. See sinnwerkstatt@591684e for a possible patch.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.