May 4, 2014

desupero said: I saw your posts on maperative and wondered if you could explain if the tiles are hosted on a local domain (hard drive) how you would point to them (mbtiles) within a html webpage (once again on local host). Also could you tell me where the Walkingpapers file is output to please?

mbtiles: you would need a tile server installed locally that knows how to fetch tiles from the mbtiles file. See https://github.com/mapbox/mbtiles-spec/wiki/Implementations for more info.

WalkingPapers: by default it exports to the output subdirectory, but you can change that, see the following line:

cmd.bitmap_file = “output/walking_papers_{0}.png”.format(page_id)

September 12, 2013
New maps of Africa on ScalableMaps

We have just released a set of Africa maps. Things brings the total number of maps on scalablemaps.com to over 200! We now also offer maps in the Adobe Illustrator file format, as well as PDF files, all coming with editable layers.

Click on the images below to go to each individual catalog. And here’s a complete gallery of our Africa maps. More coming soon!

Western Africa

Northeastern Africa

Central Africa

Southern Africa

June 3, 2013
New vector maps available on ScalableMaps.com

We have released three sets of new maps on scalablemaps.com, based on Natural Earth data:

Russia

China

Australia

More maps coming soon!

June 1, 2013
ScalableMaps: a place to find royalty-free vector maps of the world

A couple of months ago we have set up a new website called ScalableMaps with the intention of offering reasonably priced royalty-free vector maps of the world from open geo sources like OpenStreetMap and Natural Earth. The idea is to offer an alternative to expensive “professional” maps that are offered on other map web shops.

Currently we offer maps in layered PDF format. We are also thinking about providing maps in AI (Adobe Illustrator) format in the future, if there is enough interest.

The site’s list of maps is growing day by day and we are also doing custom-made maps when customers request them. There are also some free sample maps that you can try out. So go ahead and have a look!

Manhattan, New York

March 31, 2013
The problem with OpenStreetMap multipolygons

Here’s a very simple example of why I think OpenStreetMap multipolygons are a disaster.

Let’s say you download a data extract of an area and you get a relation that has six member ways (all of them in outer role). The way most extracts work, you only get those ways that cross (or are inside) the download bounding box, in our case there are only two such ways:

situation

What now? In normal situations you would be able to clip the two ways using the bounding box and then connect them along the box. But the trouble is, you have two different (and equally valid) possibilities:

solution 1

solution 2

How do you decide which is the correct solution, is the body of the polygon in the center between the two ways or is it on opposite sides? Let’s see what options we have:

  • Orientation of ways: no help here - ways (and rings) can be oriented any way you like in OSM multipolygons. Usually in GIS and graphics polygons follow a clockwise/anti-clockwise rule, but in OSM this practice was abandoned. The only reason for this I could think of is to make it easier for the mappers to edit maps.
  • Member roles: in this case the outer/inner roles don’t help very much.
  • Tagging: I wouldn’t want to get into that mess. And there’s no general tagging solution for this problem, as far as I know.
  • Requiring that extracts contain all the relation’s members: OSM has a lot of very large relations that span hundreds of kilometers and even whole continents. Why would I want to have all of the Russia’s coastline when I download the extract of, say, small part of Estonia?

Don’t be fooled by the simplicity of my example into thinking that this is a rare case. Lately I’ve been working a lot with extracts of cities and I get into these kinds of problems all the time: riverbanks, forests, administrative boundaries are typical examples of multipolygons that tend to be big and become ambiguous when used in extracts.

Basically, OSM multipolygons are a disaster. The “rules” (a.k.a. “recommendations”) on the wiki page change often, and not for the better. There’s a tendency to recommend very liberal ways of constructing multipolygons - nothing’s really mandatory and it is left to the consumer of the data to deal with the headaches. This is a very shortsighted approach, in my opinion, and it will hurt the project and the community in the (not so) long term. If the data cannot be used by “ordinary” users without complex toolchains and expensive hardware resources, then what is the purpose of it all?

Data hoarding for the sake of it?

August 24, 2012

irbash said: Hi, I was following your 10 steps, and I am stuck at the 9th one where I am trying to do ftp-upload. I get an error when I do that. I have created a local ftp site and I can access it from the browser, but when I give the same in maperitive I get a log list of error, the first one of which is: SystemAggregateException: One or more errors occurred SocketException: The requested name is valid, but no data of requested type was found. Can you help me with this issue... Thanks

Googling for “The requested name is valid, but no data of requested type was found” tells me it’s some network-related issue. Maybe your ftp-upload command line is wrong - make sure the host parameter points to a valid IP or host name (without the port number).

June 30, 2012
Maperitive: Alpenglow Effect Using A Custom Shader

The latest release comes with a new Python script called Alpenglow.py which renders a hillshading relief adding some yellowish tint to illuminated high slopes to enhance the 3D effect. It was inspired by the “See the light: How to make illuminated shaded relief in Photoshop 6.0" article on the excellent shadedrelief.com site.

You can run the script by executing

run-python Samples/Python/Alpenglow.py

The script generates the hillshading for a fixed map area in Switzerland, but you can change this quite easily in the script. You can also change other parameters, like shading (and alpenglow) colors, elevation ranges etc.

The script also demonstrates the power of writing a custom shader. A shader transforms a small part of the digital elevation model (DEM) into a pixel color, based on the elevation, aspect and the slope of that part of the DEM. This way you can write your own hillshading effects function and then supply it to the generator. Here’s how it’s done for Alpenglow.py:

# Execute the hillshading
bitmap = ReliefUtils.generate_relief_bitmap(dem, relief_bbox, Srid.WebMercator, 1, alpenglow)

The last parameter of the generate_relief_bitmap function is the shader function, in our case called alpenglow:

# The actual shader function which is called for each pixel of the hillshading bitmap.
# It receives the elevation, the aspect (orientation) of the slope and the steepnes (slope).
def alpenglow(elevation, aspect, slope):
    sin_slope = math.sin (slope)

    nx = math.cos(aspect) * sin_slope
    ny = math.sin(aspect) * sin_slope
    nz = math.cos(slope)

    direction = dotproduct(nx, ny, nz, lx, ly, lz)

    direction = (direction - minDirection) / (1 - minDirection);
    if direction < 0:
        direction = 0

    # This is how we can mix two colors together.
    shade_color = shade_base_color.mix (light_color, direction)

    if direction > 0.0 and elevation > min_alpenglow_elevation:
        elevation_factor = min((elevation - min_alpenglow_elevation) / delta_alpenglow_elevation, 1);

        alpenglow_factor = math.pow(direction, 4)
        return shade_color.mix (alpenglow_color, elevation_factor * alpenglow_factor).argb;

    return shade_color.argb;

May 24, 2012
Mercator’s Egg

UPDATE: my math was buggy, the eggs look a bit different after the correction. Note that the formula fails on very large distances (> 2000 km).

A little Maperitive Python script I was playing with today, showing the line of distance of 3000 km (larger egg) and 2000 km (smaller egg) from my home town of Maribor, drawn on the standard Web Mercator projection map:

Here’s the script:

from maperipy import *
import math

location = Point(15.6530555556, 46.5575)
distance = 3000000

layer = Map.add_custom_layer()

symbol = PolygonSymbol("circle", Srid.Wgs84LonLat)
symbol.style.pen_width = 8
symbol.style.pen_color = Color("blue")
symbol.style.pen_opacity = 0.5
symbol.style.fill_opacity = 0

earth_circumference = 6371000 * math.pi * 2;
points = []
arc = distance / earth_circumference * 360;

for angle in range(0, 360):
    radians = math.radians(angle)
    y = location.y + math.sin(radians) * arc
    lat_factor = math.cos(math.radians(y))
    x = location.x + math.cos(radians) * arc / lat_factor
    points.append(Point(x,y))

circle = Polygon(LinearRing(points))
symbol.add(circle)

layer.add_symbol(symbol)

May 16, 2012
11 Things You Should Learn Before Learning To Code

Here’s a list of ten skills that are much more important to get you through life than learning to code (in order of priority, set by me):

  1. Learn how to swim.
  2. Learn how to stay healthy and in shape.
  3. Learn the basics of food energy intake.
  4. Learn how to cook a decent (and healthy) meal.
  5. Learn how to use your mother tongue.
  6. Learn how to keep your personal finances in order. Think Greece & subprime loans.
  7. Learn a foreign language.
  8. Learn how to ride a bike.
  9. Learn how to drive a car.
  10. Learn how to use a washing machine.
  11. Learn how to find stuff on the internet.

May 5, 2012
Maperitive: Walking Papers-Like Script

The latest Maperitive 2.0 beta release comes with a new script which can generate a grid of bitmap exports similar to walking papers. The added value is that you can do walking papers for your own vector data and map styles, not just prerendered web tiles.

How To Use

A brief description of how to generate your own walking papers exports.

1. Define Map Area

In Maperitive, place printing bounds on the map area you’re interested in. The printing bounds do not have to match the dimensions of standard paper sizes.

I choose the center of Ljubljana for this sample:

2. Set Export Parameters

There are a few settings in the Samples/Python/WalkingPapers.py script which you can use to control the exporting process (see the detailed instructions in the script itself):

  • map scale: this is the map scale for individual exported page. I choose 10,000, which in my case will result in a 2x3 pages grid.
  • paper size and orientation: you can leave the default A4 landscape, if you like.
  • paper margins: the default is 5 mm on each side of the page.
  • page overlap: this is a factor (from 0 to 0.25) which tells Maperitive how much adjacent pages should overlap. 0.25 means 1/4 of the page (on each side) will overlap. The default set in the script is 0.1 (10%).

3. Run The Script

… either by drag & dropping it into Maperitive or by executing

 run-python Samples/Python/WalkingPapers.py

Sample Results

Here’s one of the exported pages:

Future Improvements

You will be able to supply command-line parameters to these kinds of scripts in the future, so manual editing of the script before running it will no longer be necessary.

Liked posts on Tumblr: More liked posts »