User:Zache

From MediaWiki.org
Jump to navigation Jump to search



Alkuperäinen kartta

Kartta Graph-tagilla piirrettynä

Todo
  • projektio oikeaksi
  • meret kartalle
  • ruotsi eriväriseksi
  • pisteiden värit järkeviksi
  • selostustekstit pisteille samanvärisinä kuin mitä pisteet ovat
  • selostusteksti kartan yläreunaan sille mistä kartassa on kyse



<graph>

{
  "version": 2,
  "width": 200,
  "height": 250,
  "padding": 12,
  "background": "#edf1f7",
  "data": [
    {
      "name": "map",
      "url": "wikiraw:///mw:Extension:Graph/Demo/RawData:WorldMap-iso2-json",
      "format": {"type": "topojson", "feature": "countries"},
      "transform": [
        {
          "type": "geopath",
          "value": "data",
          "scale": 450,
          "center": [5,70],
          "translate": [0,0],
          "projection": "mercator"
        }
      ]
    },
    {
      "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": "geo",
          "projection": "mercator",
          "scale": 450,
          "center": [5,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"
    },

  ],
 
  "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>