Wykres commitów

601 Commity (e62162fb38e261c2255220fd9d880e78875ada60)

Autor SHA1 Wiadomość Data
David Decotigny 26bde42e7a Fixed layout for RTL languages
With RTL languages, ALIGN_RIGHT is interpreted as ALIGN_LEFT by
default in the layout objects, but only when the text is "strongly"
RTL (eg. arabic only, no western text intermixed). This breaks the
asumptions we made for our layout of the index streets. This patch
tells the pango layout manager to ignore this and always interpret
ALIGN_RIGHT as ALIGN_RIGHT.

Signed-off-by: David Decotigny <d2@maposmatic.org>
2010-08-07 21:39:38 +02:00
David Decotigny b9850b4ce5 Cosmetics: nicer use of coords API
We use BoundingBox::as_wkt() to build the surrounding rectangle for
the shade.

Signed-off-by: David Decotigny <d2@maposmatic.org>
2010-08-07 21:39:38 +02:00
David Decotigny f8a0c23a42 WIP-2: render index from DB, no grid
Signed-off-by: David Decotigny <d2@maposmatic.org>
2010-08-07 21:39:38 +02:00
Maxime Petazzoni 31c198f60a Starting cleanup of the renderer code
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-07 21:37:46 +02:00
Maxime Petazzoni f74bee6493 Update i18n support for OCitySMap 2
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-07 20:46:07 +02:00
Maxime Petazzoni fb9fb66d66 More work on the plain renderer
Fix the automatic font size calculation for the title and the copyright
notice.

Fix the placement, size and display of the copyright notice.

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-07 20:45:23 +02:00
Maxime Petazzoni 8bfe936eb2 Improving the plain renderer's layout
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-07 19:10:04 +02:00
Maxime Petazzoni 4a3829cacc Higher definition OSM logo
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-07 19:10:04 +02:00
Maxime Petazzoni 355815b56c Cleanup and documentation
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-07 19:10:04 +02:00
David Decotigny d3146f1223 WIP-1: basig get_streets query
Signed-off-by: David Decotigny <d2@maposmatic.org>
2010-08-07 14:39:07 +02:00
David Decotigny 89caded1f0 Cosmetic refactoring of coords api
Basic changes:
 - new as_wkt() method that returns a WKT for the current bounding box
 - renamed self.ptstr -> _ptstr
 - renamed parse -> parse_latlon_strtuple

Signed-off-by: David Decotigny <d2@maposmatic.org>
2010-08-07 14:35:53 +02:00
David Decotigny 9e66e8fb25 Cosmetic refactoring: code sharing for drawing primitives 2010-08-07 13:18:59 +02:00
David Decotigny f83fe95126 Unit test uses relative paths for config files
Signed-off-by: David Decotigny <d2@maposmatic.org>
2010-08-07 13:16:54 +02:00
David Decotigny 5885e3a630 Rearranged files and sources for index rendering
Signed-off-by: David Decotigny <d2@maposmatic.org>
2010-08-07 12:39:39 +02:00
Maxime Petazzoni 54d5c4073f Cleanup and documentation
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-07 11:52:39 +02:00
Maxime Petazzoni ac364f23f0 Merge branch 'master' into ocitysmap2 2010-08-07 09:54:00 +02:00
Maxime Petazzoni 7b1e07d292 Re-integrating index data requests
Start working on re-integrating the SQL queries to feed the index (not
functional right now).

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-07 09:49:12 +02:00
Maxime Petazzoni 8138df9177 Point Norvegian Bokmål to the generic i18n layer
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-07 09:44:57 +02:00
Thomas Petazzoni c0e5d094dd Change how the configuration files path are passed to OCitySMap
Instead of having to pass a list, we can now also pass just a single
string or None, in which case a default set of config file paths will
be tried.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@enix.org>
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-07 09:18:27 +02:00
Maxime Petazzoni b2a81bc41b Remove admin_level=8 from the admin_city_names index
As we no longer restrict rendering to administrative boundaries of
level 8, rework the index for city name lookups.

NOTE: if you have an existing PostGIS database, you will need to
recreate the index. First, remove the existing one with:
`DROP INDEX admin_city_names` then re-create it with the
`CREATE INDEX ...` statement from ocitysmap-init.sql.

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-07 08:53:29 +02:00
Maxime Petazzoni cb4d258d2e Implement street index layout
Implement all functionality for rendering the index in a specified
graphical area. The index automatically shrinks to the minimum space it
needs by adjusting one of the dimension (passed as a parameter).

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-07 00:22:03 +02:00
Maxime Petazzoni cad5629cd5 Fix how the best fit paper size is returned
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-06 17:30:51 +02:00
Maxime Petazzoni f4ab45b8bb Better handling of portrait/landscape orientation
The compatible paper sizes no return 5-uples that specify if the
provided bounding box fits in portrait and/or in landscape mode.

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-06 13:09:33 +02:00
Maxime Petazzoni a9ba85ea1f Fix PNG rendering
The layout renderers now work in a unitless fashion where dimensions are
expressed in "dots". A RenderingSession object defines and stores how
dots are obtained from typographic/printing points depending on the
provided DPI.

The DPI for vector-based surfaces is set to 72, because a typographic
point is 1/72th of an inch. For PNG surfaces, its value is configurable
in the OCitySMap configuration as 'png_dpi' in the 'rendering' section.
It defaults to 300dpi.

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-06 12:04:20 +02:00
Maxime Petazzoni e3aa201597 Add Norvegian Bokmål translation
Adds the OCitySMap translation in Bokmål (nb) contributed by Hans F.
Nordhaug.

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-06 10:45:56 +02:00
Maxime Petazzoni 55e5396aeb Move the OSM logo
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-06 10:42:53 +02:00
Maxime Petazzoni d211423c58 Update the OCitySMap config template for version 2
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-06 10:09:22 +02:00
Maxime Petazzoni ebc7a51d3c Automatic portrait/landscape orientation
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-06 10:03:22 +02:00
Maxime Petazzoni 148aa82641 Lazy database connection in OCitySMap
Only connect to the PostGIS datasource when needed so OCitySMap objects
can be instancied and used without connecting to the database if it is
not required.

Remove some debugging messages, and tweaks to the layout renderers
registry.

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-06 10:00:46 +02:00
Maxime Petazzoni 1e4e57f136 Deprecate the original OCitySMap module
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-06 10:00:41 +02:00
Maxime Petazzoni abcbddf8c2 Ignore .pyc files in OCitySMap 2
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-06 10:00:24 +02:00
Maxime Petazzoni 7858037fac Cleanup and documentation
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-06 10:00:03 +02:00
Maxime Petazzoni bec0a07f94 Add a custom, fitted paper format
When returning the list of compatible paper sizes for the provided
bounding box, add a custom format that is exactly fitted to the bounding
box if the user doesn't want one of the preset paper sizes.

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-06 09:54:40 +02:00
Maxime Petazzoni 92bbb4b713 Implement stylesheet configuration parsing and registry
Parse the stylesheet definitions (we'll support several Mapnik
stylesheets, eventually from contributors) from the OCitySMap
configuration file. Provide a registry to list and access them.

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-06 09:49:12 +02:00
Maxime Petazzoni a7b9382bd7 Implement a renderers registry in the renderers module
OCitySMap now provides a quick public API to get the list of all
implemented layout renderers, or to get one directly by name. Renderer
classes are returned, not instances.

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-06 09:45:30 +02:00
Maxime Petazzoni 5b51658254 Draw grid labels in the PlainRenderer
Grid labels (letters horizontally, numbers vertically) are now drawn
directly in Cairo. The plain renderer draws them outside of the map area
in a small margin. Other renderers may choose to do otherwise (directly
on the map area, not displaying them at all, etc.).

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-06 09:40:39 +02:00
Maxime Petazzoni 07eb3a9690 Re-implement the grey shading
When rendering an administrative boundary, we overlay a transparent grey
shade around the city.

A WKT MULTIPOLYGON is created from the corrected bounding box and the
administrative boundary (as an inner hole). A shape file is then created
from this polygon and added to the rendering.

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-06 09:35:24 +02:00
Maxime Petazzoni 7707cdf37e Make the OCitySMap object actually render maps
Integrate the main OCitySMap object to the layout renderers so it can
render maps. Renderers now work in typographic points.

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-06 09:30:12 +02:00
Maxime Petazzoni 04ed36dd85 Automatically adapt the geographical bounding box to the paper size
After a compatible paper has been chosen, the geographic bounding box
requested for rendering (or the bounding box of the administrative
boundary requested) doesn't fill the paper entirely. The bounding box is
thus extented by Mapnik into a corrected bounding box, corresponding
exactly to what is rendered on the paper.

The bounding box used by the Grid object is also slightly expanded to
accomodate for the small imprecisions of the various projections, which
made the grid lines not fill the bounding box entirely.

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-06 09:18:56 +02:00
Maxime Petazzoni 35e9fcac8f Continue heavy work on OCitySMap 2
Re-implement configuration file parsing to get access to the database.
The request timeout is now configurable in the 'datasource'
configuration section as 'request_timeout'. It defaults to 15 minutes.

Re-integrate the i18n and languages support.

Re-implement the map grid support. From the corrected geographical
bounding box, the Grid object can generate an ESRI Shapefile with the
grid lines. The grid size automatically adjusts to lower sizes if the
bounding box is smaller.

Stub implementation of the StreetIndex object that will handle data
gathering, outputting as CSV and rendering into a given surface.

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-06 09:04:20 +02:00
Maxime Petazzoni ddd59b11f9 Foundation for the new OCitySMap rendering module
This new OCitySMap version aims at providing a more print-oriented
map rendering engine.

Its main features include being aware of paper sizes and constraints,
but also providing different "renderers" implementing rendering layouts
for the maps. For now, only the PlainRenderer which renderers a
full-page map is implemented, but renderers that also generate an index
will be available.

The main idea is that we no longer generate a separate index. The
generated map includes (or not) an index depending on the rendering
layout used to render it.

Finally, each renderer is able to tell which paper sizes are compatible
with the bounding box from a "geographic" resolution.

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-06 08:48:07 +02:00
Thomas Petazzoni 66f05f647f Update INSTALL procedure for Unifont
In order to get proper rendering of Korean, Chinese, Japanese and
probably other "special" characters, the unifont font must be
enabled. This patch updates the INSTALL procedure to :

 * Install the ttf-unifont package

 * Patch Mapnik so that it recursively searches for fonts

 * Compile Mapnik with SYSTEM_FONTS=/usr/share/fonts

 * Modify the mapnik-osm configuration file to enable the usage of
   unifont

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-03 10:08:15 +02:00
Maxime Petazzoni 386ceea841 Streets and amenities queries optimization
NOTE: this optimization requires GEOS >= 3.2 and still doesn't support
cities with enclaves.

This commits introduces a previously discussed query optimization for
getting the streets and amenities. The corresponding discussion can be
found in the archives at:
http://lists.nongnu.org/archive/html/maposmatic-dev/2010-02/msg00210.html
and on the wiki at
http://wiki.maposmatic.org/doku.php?id=dev:request_optimization

The idea is to pre-compute the POLYGON() of the city or area we are
rendering and put it directly in the query. This removes a JOIN and a
CASE from the query, and also allows for some nice code refactoring
since we no longer have to differenciate between get_streets_by_name and
get_streets_by_osmid (same for amenities), it's all based on this
pre-calculated POLYGON area.

On my machine, getting the streets for Paris is amazingly fast:

2010-06-21 13:08:28,352 INFO(maposmatic:8965): Getting streets...
2010-06-21 13:08:31,487 DEBUG(maposmatic:8965): Got streets (5107).

While it takes several minutes without this change. The rendering
process is now mostly CPU-bound during the actual map rendering with
Mapnik, and PostgreSQL is no longer the main bottleneck during a
rendering.

We can also now get rid of the cities_area_by_name and
cities_area_by_osmid views, and also perform a small optimization on the
contour request.

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-07-16 11:34:27 +02:00
Maxime Petazzoni 7403da276b Fix Plural-Forms gettext header for Catalan
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-06-30 15:48:09 +02:00
Maxime Petazzoni e5853f8103 German prefix rules
Adds the German prefix rules, provided by an anonymous contributor in
bug #29259.

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-06-11 17:37:32 +02:00
Maxime Petazzoni 4aa5417a53 Added some more French prefixes
Adds the following prefixes for French (and Catalan for cities with
French names):

  * Accès
  * Autoroute
  * Barrage
  * Cavée
  * Coin
  * Descente
  * Escalier(s)
  * Funiculaire
  * Jardin(s)
  * Môle
  * Rampe
  * Rang
  * Sente
  * Terre-Plein
  * Télécabine
  * Tunnel
  * Virage

Also added "aux" in the determinents for French ("Rue aux Juifs" for
example).

This closes support question sr#107392.

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-06-11 17:23:09 +02:00
Maxime Petazzoni 1aee71e1ab Missing datetime import for dynamic copyright notice
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-03-25 19:28:18 +01:00
Maxime Petazzoni e853633516 Dynamic copyright notice, everywhere
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-03-20 15:48:36 +01:00
Maxime Petazzoni 24301e43b2 Use a dynamic copyright notice year number
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-03-20 15:39:42 +01:00
Maxime Petazzoni 833ded55af New prefixes for Spanish
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-03-15 19:32:35 +01:00