Fresh, clean, patch against the maposmatic repo for simplifying the
Turkish translation. This patch contains only the language manipulation.
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Fixed cancel form submission and re-added recreate form button on the
map list. Added map thumbnail display.
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
New website design based on Bootstrap. Complete revamp of the UI
interface and of the interface paradigms. Complete rewrite of the map
creation wizard, now simpler and with less steps.
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
This allows us to know if the PostGIS database is up and gets us a lag
information that is not refreshed only every minute by a cronjob.
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Use the more traditional '.dist' extension for configuration templates
that are part of the MapOSMatic distribution. Update the installation
instructions accordingly.
Includes some style fixes in the INSTALL and template files, as well as
a fix to the wrapper script to correctly allow for an undefined log
location (defaults to stderr).
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Check that calls to /apis/papersize/ have latitude in [-90.0, 90.0] and
longitude in [-180.0, 180.0].
Signed-off-by: David MENTRE <dmentre@linux-france.org>
The GIS database lag information was directly read from the GIS
database for every web page rendered by the MapOSMatic web
server. This is very inefficient since this value changes very
slowly. Instead, read the value from a local file which gets updated
from time to time by a cronjob using a small shell script.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Since 1.2, the declaration for the RSS feed url has slightly changed,
and the old way is no longer available in Django 1.4. So, switch to
the new way.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@enix.org>
In Django 1.4, the function-style template loading is no longer
possible, only the class-style template loading (available since
Django 1.2) is possible.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@enix.org>
Django 1.4 no longer supports the old configuration style for the
database, and the new way has been available since Django 1.2, so
let's use the new way.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@enix.org>
Even though spanish is a quite widely used language in some parts of
the US, it remains less important than english, so make sure en_US is
the default language for maps rendered in the US.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@enix.org>
Adds the _("Layout required") and _("Stylesheet required") strings to Django
Also includes the Dutch translation for these messages.
CC: Thomas Petazzoni <thomas.petazzoni@enix.org>
Signed-off-by: Jeroen van Rijn <jvrnix@gmail.com>
All the jobs that are part of our database and have been submitted
with the previous MapOSMatic version have their layout, stylesheet,
paper_width_mm and paper_height_mm set to default values (empty for
string fields, -1 for integer fields), because they didn't exist in
the previous MapOSMatic version.
The problem is that when an user clicks on a "Recreate this map" link,
we re-create a new job with the same properties... and it is now
invalid to have a job with layout, stylesheet empty or unset
paper_width_mm and paper_height_mm.
Therefore, we adjust can_recreate() to ensure that it is not possible
to recreate jobs from jobs that have been rendered with the old
version of MapOSMatic. We could have set layout and stylesheet to
default values when they are empty, but it was much more complicated
to set a sane value for paper_width_mm and paper_height_mm.
We hope this is one of the reason why we have new jobs with the
stylesheet and layout fields empty, and the paper_width_mm and
paper_height_mm fields set to -1.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@enix.org>
The job-page.html was already properly calling job.can_recreate() to
know if it was possible to render again the same job, but job.html
wasn't.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@enix.org>
We now show an error when the Ajax request that fetches the compatible
paper sizes. We also fix some JS-code that shows/hide the prev/next
links in the wizard.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@enix.org>
We have received several rendering requests with layout and stylesheet
empty. We believe that people might have written scripts against the
previous version of MapOSMatic, and so they didn't fill those
fields. Therefore, we add some form-level validation logic to reject
jobs that have layout and/or stylesheet empty.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@enix.org>
Nominatim wants heavy users of their API to give a contact email for the
admins of the service making the requests in case something goes wrong.
Also set an Accept-Language header for the search queries to get
Nominatim results in the browser's language.
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Merge all developments from hackfests in 2011 and 2012.
Conflicts:
www/maposmatic/nominatim.py
www/media/osm_map.js
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Automatically send an email to the configured admins with a traceback of
the rendering exception when a rendering fails.
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Updated the django.po files to add the 'nynorsk' string.
Translated the 'nynorsk' string into Dutch, French, German, Italian and Portuguese.
Signed-off-by: Jeroen van Rijn <jvrnix@gmail.com>
Until now, the stylesheet description strings were coming from the
OcitySMap configuration file, the layout description strings from the
OcitySMap source code, and the paper sizes from the OcitySMap code as
well.
Unfortunately, when MapOSMatic queries the list of stylesheets,
layouts and paper sizes, OcitySMap has no idea of which language the
web site is in. OcitySMap cares about the language in which the map
will be rendered, not the language in which the website is displayed.
Therefore, in order to properly translate the stylesheet descriptions,
layout descriptions and paper sizes, we have to do it from MapOSMatic
itself. The drawback is that MapOSMatic now needs to know the list of
layouts and stylesheets, but there doesn't seem to be other reasonable
solutions.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@enix.org>
To integrate the translation for ocitysmap provided by Guttorm Flatabø,
we have to add it to MAP_LANGUAGES in settings.py as well so it's available
to choose upon creating a new map rendering.
CC: Guttorm Flatabø <post@guttormflatabo.com>
Signed-off-by: Jeroen van Rijn <jvrnix@gmail.com>
The Ctrl+drag command cannot be used on Mac platform. Use Alt+drag
instead.
Original patch submitted by Sébastien Tanguy.
Signed-off-by: David MENTRE <dmentre@linux-france.org>
Signed-off-by: Sébastien Tanguy
Simone Cortesi updated the Italian translation for MapOSMatic.
I'm (Jeroen) sending this off with a little fix-up applied.
Signed-off-by: Simone Cortesi <simone@cortesi.com>
Signed-off-by: Jeroen van Rijn <jvrnix@gmail.com>
We display a message saying that an index has not been generated if no
CSV was found, and in this case we encourage users to contribute to
OpenStreetMap. However, with the multi-page layout, we never generate
a CSV, so this message was always displayed. This commit handles this
case properly.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@enix.org>
The language selection drop-down was not working anymore after the
rework of the navigation bar because the ul#nav was over the
form#langsel and prevented clicks on the select widget.
Also fixes the navigation bar in RTL mode, which was forgotten during
the navigation bar fixes previously.
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Fixed missing logger, added copyright notice and followed Python
variable naming convention for the module-global _DB variable.
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
We want the Paypal donation button to be translated, and the user to
be redirected to a page in his/her language when making a donation.
Unfortunately, Paypal does not seem to have translations for all the
languages we support, so we default to English when the language is
not available from Paypal.
This new mechanism requires translators to add a new entry in the
PAYPAL_LANGUAGES dictionary if Paypal provides a button and a site in
their language.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@enix.org>
The problem was noticed by Jeroen van Rijn <jvrnix@gmail.com>, but a
different fix was needed to make things work properly.
Thanks Jeroen for noticing and reporting the problem!
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@enix.org>
In fact, the MapQuest service returns strange results that don't match
the osmid we have in our database, so most results are
unusable. Switch back to the original Nominatim service.
The original is _always_ better than the copy.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@enix.org>
This commit implements a new item on the right of the MapOSMatic
website, which gives users the current time delta between our GIS
database and the official OSM database.
In order to implement this, we created a small gisdb.py module which
factorizes the work of connecting to the GIS database, now used by
both the Nominatim code and our new code that fetches the last update
of the GIS database through the maposmatic_admin table.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@enix.org>
Contrary to what we initially thought, there is no way to know if
Nominatim has further results or not. Even if the first results
returned by Nominatim are limited to 5 results (i.e less than the
maximum number of results Nominatim can return on a single page), it
does not mean that Nominatim has no further results.
So, we just assume that Nominatim may have further results.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@enix.org>
Nominatim returns some search results that are not appropriate for
MaOSMatic because they do not have an administrative boundary. We show
those results so that users aren't confused, but we also display a
message explaining why those results can't be used. This commit
implements this message.
Instead of putting the message in the Javascript, which would require
interfacing the Javascript code with the Django translation/locale
system, the message is stored in an hidden <span> element in the HTML
code (and is therefore translated like all the rest of the HTML text
by the Django translation infrastructure). This message is copied by
the Javascript code at the right place when needed. We were already
doing the same thing for the #noresultsinfo message.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@enix.org>
The doQuery() Javascript function takes as argument the list of places
to excludes from the list (necessary to implement and next and
previous buttons), but we were not calling it with this argument when
the user was typing text in the input box.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@enix.org>
On the website, the language selector dropdown list was ordered in a
more or less random way, depending on how languages were listed in the
MAP_LANGUAGES array of the settings.py file. This had the unfortunate
effect of proposing a language which is not necessarily the most
common language for the country in which the city to be rendered
is. For example, for all cities located in France, the language
proposed was Catalan (because ca_FR is before fr_FR in the
alphabetically-sorted list of locales).
Therefore, this commit does two things to solve this problem:
* The MAP_LANGUAGES array in settings.py is now statically sorted by
country rather by language, and then the different languages of a
given country must be manually sorted (by the developer who adds
them) from the most widely used language in the country to the
least widely used language.
* The Javascript code is modified so that the order of the languages
in MAP_LANGUAGES is preserved. For this, a new jQuery function
called reverse() has been added.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@enix.org>
Very old jobs rendered by administrative boundary didn't store the
corresponding OSM ID, so we can't easily find them back to see if a
rendering already exists when recreating a map. This led to weird
behavior when recreating a map where the user would get redirected to a
completely different map (the most recent map rendered by administrative
boundary).
This fixes bug #31175.
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Very old jobs rendered by administrative boundary didn't store the
corresponding OSM ID, so we can't easily find them back to see if a
rendering already exists when recreating a map. This led to weird
behavior when recreating a map where the user would get redirected to a
completely different map (the most recent map rendered by administrative
boundary).
This fixes bug #31175.
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Added a few instructions in INSTALL to test. Also added instructions
in the config templates to help customize the python search path.
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
When an error occurs while processing the form's data, cleaning up the
data can result in attempting to delete non existent keys. This patch
should make the code tolerant to the half-created form data we have to
deal with in that case.
The problem happened 5 or 6 times within the last 3 weeks.
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
This patch makes sure that we can work on the exact same city envelopes
in maposmatic and ocitysmap: we now share ocitysmap's
get_geometry_from_osmid(). Previously, get_bbox_from_osmid crashed if
the osm ID was present multiple times in the polygon table, and
ignored the line table. This patch fixes both, by basing itself on
ocitysmap's 093b95bcf6f54e855b781a9ccd60ce8117b35976.
With ocitysmap 1.x, an "index" file used to be a file whose name ended
in "_index.*". With ocitysmap2, the index is generally included in the
map image (depending on the chosen page layout). But we still generate
the index separately as a CSV file. This patch simply tells that the
index file is the CSV.
In d2-ocitysmap2, the zoom factor can be defined in the
stylesheet. This patch makes sure that the stylesheet is chosen before
proposing a list of possible paper sizes. Then it determines the
possible paper sizes from this stylesheet.
When an error occurs while processing the form's data, cleaning up the
data can result in attempting to delete non existent keys. This patch
should make the code tolerant to the half-created form data we have to
deal with in that case.
The problem happened 5 or 6 times within the last 3 weeks.
The latest 2 strings now also available in Dutch.
Signed-off-by: Jeroen van Rijn <jvrnix@gmail.com>
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Significant styling improvements in the map creation wizard, involving
some HTML, CSS and translation changes.
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Introduce two hidden fields in MapRenderingJobForm to store
paper_width_mm and paper_height_mm. Those two fields are updated by
the JS code when the selected paper size changes. They are then sent
to the server as part of the wizard form and then stored in the
database.
It allows to fix the handling of paper sizes for "Best fit"
renderings.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@enix.org>
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Instead of removing languages that do not match the current country
code, we instead order the languages in the following way :
1. All languages that match the current country code
2. A separator
3. All languages that do not match the current country code
This allows to have a sane choice selected by default, to highlight
the choices that are probably the most pertinent ones, and still give
the user the opportunity to make a completely different choice. This
is especially important for bounding box renderings, since the guessed
country code may not be correct (in particular for bounding boxes
crossing country boundaries).
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@enix.org>
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
The callback that the slippy map calls when an area is selected is
modified so that it gets as argument 'bounds', which represents the
bounding box of the selected area.
Using this, we get the center of the bounding box, and using an Ajax
request, ask the reversegeo service to find the corresponding
entries. When the reply is received, we extract the country code from
the received reply.
This will be used in a later commit to pre-filter the list of
languages according to the selected geographic area.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@enix.org>
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
The .abort() method of Ajax requests allows to abort the in flight
Ajax request. We use this to abort the previous Ajax request before
starting a new one, which avoid the problem of having old Ajax request
replies coming *after* new Ajax request replies.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@enix.org>
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
By ignoring left/right movements, we avoid useless Ajax requests to
the server.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@enix.org>
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Rework the MapOSMatic logging setup to initialize both the maposmatic
and ocitysmap logging targets, and do so only once to avoid duplicate
logging messages.
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
This allows the user to immediatly start typing an administrative
name, without having to click in the <input> field.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@enix.org>
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
On the Nominatim proxy side:
* Instead of doing complex filtering/sorting on Nominatim results, we
do a simple filtering on "places", in a fixed list. Results are
kept sorted in Nominatim order.
* Nominatim results are enriched with a validity field, and reason
fields for non-validity (like "no admin boundary" or "area too
large").
* Nominatim results are also enriched with fields that allows to know
whether previous/next entries are available through Nominatim (when
the search returns more than 10 entries)
* Simplify the query_nominatim() view arguments. It now takes all
arguments through GET. 'q' for the query, 'exclude' for the set of
places to exclude.
The Nominatim proxy code has also been split in several subfunctions
for easier readability.
The JavaScript code is updated accordingly:
* Display the Nominatim icon as the list bullet. The bullet is not
visible yet due to CSS issue.
* Use the new valid/reason/reason_text fields of result entries to
determine whether an entry is valid or not, and show why it isn't
valid.
* Show prev/next buttons that trigger another Ajax query to get the
next/prev results.
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
We factorize a little bit the code to make the function simpler and
easier to read.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@enix.org>
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
* The MapRenderingJob model has been modified: the paper size is no
longer stored as a string identifying a particular paper format,
but rather two IntegerFields are used to store the width/height in
millimeters of the paper. This allows to support "Best fit" paper
size.
* The MapRenderingJobForm is extended to offer a paper orientation
selection form, with portrait/landscape selection.
* The /apis/papersize/ service now returns all informations given by
OCitySMap on allowed paper sizes, and not only the name of the
allowed paper formats.
* As the "paper size" panel is now used to also select the paper
orientation, it is renamed to "step-paper" instead of
"step-paper-size".
* A bunch of Javascript code is used to update the orientation
selector depending on the selected paper format.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@enix.org>
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Currently, this works only for bounding boxes, not for administrative
boundaries.
Signed-off-by: Gaël Utard <gael.utard@laposte.net>
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Remove the overhead of parsing blog entries when generating the rss
feed. This saves a lot of CPU.
Signed-off-by: Gaël Utard <gael.utard@laposte.net>
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Currently, this works only for bounding boxes, not for administrative
boundaries.
Signed-off-by: Gaël Utard <gael.utard@laposte.net>
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
The service added aims to query (lat/lon) Nominatim, fetch the resulting
XML, parse it, then returns it into JSON.
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Remove the overhead of parsing blog entries when generating the rss
feed. This saves a lot of CPU.
Signed-off-by: Gaël Utard <gael.utard@laposte.net>
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Adding to nominatim results the bounding box coordinates, in order to
check if the size is correct.
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Make sure the new MapRenderingJob fields (layout, stylesheet and
papersize) are copied when recreating a map. Removing the cache check,
too.
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Now that we allow all administrative boundaries to be rendered, remove
the filtering of the Nomitanim results on an admin_level from the
Javascript that handles the suggest box.
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>