User:Zache/testmap2

From mediawiki.org


<graph>

{
  "version": 2,
  "width": 500,
  "height": 260,
  "padding": 12,
  "background": "#edf1f7",
  "data": [
    {
      "name": "map",
      "url": "geoshape:///?idcolumn=country&query=SELECT%20%3Fcountry%20%3FcountryLabel%20WHERE%20%7B%0A%20%20%7B%0A%20%20%20%20%20SELECT%20DISTINCT%20%3Fcountry%20%20WHERE%20%7B%0A%20%20%20%20%20%20%20%3Fplace%20wdt%3AP17%20%3Fcountry%20.%0A%20%20%20%20%20%7D%0A%20%20%7D%0A%20%20%3Fcountry%20wdt%3AP299%20%3Fcode%20.%0A%20%20FILTER%20%28%3Fcountry%20IN%20%28wd%3AQ20%2C%20wd%3AQ33%2C%20wd%3AQ34%29%29%0A%0A%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22%20%7D%0A%7D%20",
      "format": {"type": "topojson","feature": "data"},
      "transform": [
        {
          "type": "geopath",
          "value": "data",
          "scale": 1000,
          "center": [0,70],
          "translate": [0,0],
          "projection": "equirectangular"
        }
      ]
    },
    {
      "name": "points",
      "url": "wikidatasparql:///?query=PREFIX%20wd%3A%20%3Chttp%3A%2F%2Fwww.wikidata.org%2Fentity%2F%3E%0APREFIX%20wdt%3A%20%3Chttp%3A%2F%2Fwww.wikidata.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0A%0ASELECT%20DISTINCT%20%3FcityLabel%20%20%20%281000%20as%20%3Fpopulation%29%20%20%3Fgps%20%28%3Flayer%20as%20%3Ffill%29%0AWHERE%20%0A%7B%0A%20%20%3Fcity%20%28wdt%3AP31%2Fwdt%3AP279%2a%29%20wd%3AQ23397.%0A%20%20%3Fcity%20wdt%3AP17%20wd%3AQ34.%20%20%0A%20%20%3Fcity%20wdt%3AP625%20%3Fgps%20.%0A%20%20%3Fcity%20rdfs%3Alabel%20%3Flayer%20.%20%20%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%0A%20%20%20%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22%20.%0A%20%20%7D%0A%20%20FILTER%20regex%28%3Flayer%2C%20%22L%C3%A5ngsj%C3%B6n%7CL%C3%A5ngtj%C3%A4rn%7CL%C3%A5ngtr%C3%A4sket%7CGukkesjaure%7CKukkajaure%7CKukkesjaure%7CKukasj%C3%A4rvi%7CPitk%C3%A4j%C3%A4rvi%7CL%C3%A5ngetj%C3%A4rn%7CL%C3%A5ngatj%C3%A4rn%7CKukkesjauratj%7CGukkejaure%7CGukkistr%C3%A4sket%7CGukkesjauratj%7CKukkajauratj%22%2C%20%22i%22%29%20%0A%0A%7D%0AORDER%20BY%20DESC%28%3Fpopulation%29%20",
      "format": {
        "type": "json"
      },
      "transform": [
        {"type": "sort", "by": "-population"},
        {
          "type": "geo",
          "projection": "equirectangular",
          "scale": 1000,
          "center": [0,70],
          "translate": [0,0],
          "lon": "gps[0]",
          "lat": "gps[1]"
        }
      ]
    }
  ],

  "scales": [
    {
      "name": "size",
      "type": "linear",
      "domain": {"data": "points", "field": "population"},
      "range": [5, 5]
    },
    {
      "name": "fill",
      "type": "ordinal",
      "domain": {"data": "points", "field": "fill"},
      "range": "category20"
    },
    {
      "name": "c",
      "type": "ordinal",
      "domain": {"data": "points", "field": "fill"},
      "range": "category20"
    },
  ],
 
  "marks": [
    {
      "name": "map",
      "type": "path",
      "from": {"data": "map"},
      "properties": {
        "enter": {
          "fill": {"value": "silver"},
          "stroke": {"value":"black" },
          "path": {"field": "layout_path"}
        }
      }
    },
    {
      "name": "circle",
      "type": "symbol",
      "from": {"data": "points"},
      "properties": {
        "enter": {
          "size": {"scale": "size", "field": "population"},
          "fill": {"scale": "fill", "field": "fill" },
          "fillOpacity": {"value": 1},
          "stroke": {"scale": "fill", "field": "fill" },
          "strokeWidth": {"value": 1},
          "x": {"field": "layout_x"},
          "y": {"field": "layout_y"}
        }
      }
    }
  ]
}

</graph>