Welcome to the geofictician wiki.

User:Luciano/Sandbox/Maperitive/OverviewMap

From Geofictician
Jump to navigationJump to search

This is an "overview map" that is made using some extracts and transformations on the OGF world backup file (.pbf), followed by a Maperitive ruleset.

Error creating thumbnail: File with dimensions greater than 12.5 MP

Note that in the above map, some countries aren't showing up, and there are lots of mistakes. That's because it's based on the actual current data in OGF put there by mappers. Countries with broken border relations don't show up at all. Other countries have out of date or incorrect information of various kinds in their labels.

In order for this to be successful, we would need to "clean up" our map data a lot

The advantage would be that we could eliminate the need to maintain a separate overview map. We could create a script to re-generate this map on a regular basis.

In my offline OSM file, I added a tag called "ogf:status" that could be used to drive the coloring on the map. So the colors are based on my additions to the .OSM file.

One challenge was to get country labels that appear in a useful way. I did some data transformations using osmconvert and osmfilter first. To make typing the commands easier (I still haven't made a script), I named my files "o.osm", "ov.osm" etc. The effect of these transformations is to

  • simplify the data set, eliminating as much irrelevant data as possible from the world file - no streets, no features... only coastlines and country boundaries
>osmconvert o.pbf -o=o.o5m

>osmfilter o.o5m --keep="natural=coastline or admin_level<3 " -o=ov.osm
  • create a label node for the center of each admin_level=2 boundary relation and merge it into the osm file
>osmconvert ov.osm --all-to-nodes -o=on.osm

>osmfilter on.osm --keep="@id>2000000000000000 and type=boundary and admin_level<3" -o=ob.osm

>osmconvert ov.osm ob.osm -o=om.osm

Then we can open the output file, om.osm, using Maperitive, with the following ruleset:

// origin: http://opengeofiction.net/wiki/index.php/User:Luciano/Sandbox/Maperitive/OverviewMap

features
	lines
		all lines : 
		
	areas
		active : relation[ ( NOT "ogf:owner"="[all]" AND NOT "ogf:owner"="[free]" AND NOT "ogf:status" ) OR "ogf:status"="active"]
		all : relation[ ( "ogf:owner"="[all]" AND NOT "ogf:owner"="[free]" AND NOT "ogf:status" ) OR "ogf:status"="all"]
		collab : relation["ogf:status"="collaborative"]
		free : relation[ ( "ogf:owner"="[free]" AND NOT "ogf:owner"="[all]" AND NOT "ogf:status" ) OR "ogf:status"="free"]
		inactive : relation["ogf:status"="inactive"]
		
	points
		label : [ogf:id AND type=boundary] 
		
properties
	map-background-color : #e1e1e1

rules

	target : label
		define
			font-family : Ariel
			text-align-horizontal : center
			text-align-vertical : center
			text : [[ogf:id]] "\n" name "\n" [[ogf:owner]] 
			font-size : 10
			font-weight : bold
			fill-color : #fcfcfb
			text-color : #060606
			text-halo-width : 0
			shape : square
			shield-resize-mode : free
		draw : shield

	target : free
		define
			fill-color : #009000
			fill-opacity : 0.7
		draw : fill

	target : inactive
		define
			fill-color : #FFFF00
			fill-opacity : 0.7
		draw : fill

	target : collab
		define
			fill-color : #800080
			fill-opacity : 0.7
		draw : fill

	target : all
		define
			fill-color : #0000FF
			fill-opacity : 0.7
		draw : fill

	target : active
		define
			fill-color : #0E1E0E
			fill-opacity : 0.2
		draw : fill

	target : all lines
		define
			line-color : #fbe56b
			line-width : 2
		draw : line