afhuertass
Hi!
I’m new to elixir world and to learn a few things I got into a project of fetching data from an API and plotting some stuff. The data I want to plot is map/geo data from a Finnish WebFeatureServer.
After fetching the data, I’m doing something like:
base_map =
Vl.new(width: 400, height: 400)
|> Vl.data_from_values(features ,format: :json , type: :featureCollection)
|> Vl.projection(type: :mercator)
|> Vl.mark(:geoshape)
|> Vl.encode_field(:color, "properties.naiset", type: :quantitative)
where features is the list of features from the server, but the result is not what I hoped for: https://pasteboard.co/Qsrt4CyZXwAy.png
I tried analysing the Vega Spec output, since I’m also new to Vega I’m not quite sure what I’m doing wrong (my guess is something with the scale or projection)
%{
"$schema" => "https://vega.github.io/schema/vega-lite/v5.json",
"data" => %{
"format" => "json",
"type" => "featurecollection",
"values" => [
%{
"bbox" => [243238.7074, 7276001.5097, 627859.7, 7776430.911],
"geometry" => %{
"coordinates" => [
[
[412373.1985, 7276001.5097],
[413803.717, 7277425.091],
[427779.649, 7292121.84],
[444538.768, 7291543.363],
[451429.652, 7295129.029],
[461616.22, 7300363.885],
[461385.917, 7289578.81],
[491950.939, 7286610.701],
[503301.393, 7289791.985],
[518535.957, 7313104.574],
[523951.184, 7311273.286],
[529768.18, 7315646.993],
[534776.431, 7300873.374],
[555960.827, 7298229.095],
[569086.753, 7303600.565],
[568767.928, 7308451.269],
[562371.144, 7316158.058],
[563104.105, 7320196.602],
[570051.364, 7321770.669],
[575008.83, 7319436.645],
[579288.478, 7321216.143],
[579928.398, 7325866.071],
[573532.923, 7328766.401],
[572435.541, 7335122.877],
[577450.11, 7336119.469],
[578610.673, 7349374.686],
[571535.284, 7350680.086],
[568892.525, 7357831.516],
[575470.26, 7375090.259],
[600847.92, 7367226.299],
[600723.816, 7369982.334],
[614767.566, 7370520.926],
[612103.6, 7377488.2],
[609809.277, 7382629.323],
[606883.5, 7386978.2],
[605693.5, 7389646.3],
[604456, 7393092.6],
[594548.9, 7408533.9],
[593130.4, ...],
[...],
...
]
],
"type" => "Polygon"
},
"geometry_name" => "geom",
"id" => "avi_vaki2020.6",
"properties" => %{
"avi" => "6",
"ika_0_14" => 26094,
"ika_0_14p" => 14.8,
"ika_15_64" => 104662,
"ika_15_64p" => 59.2,
"ika_65_" => 45909,
"ika_65_p" => 26,
"miehet" => 88437,
"miehet_p" => 50.1,
"naiset" => 88228,
"naiset_p" => 49.9,
"name" => "Lapland AVI",
"namn" => "Lapplands RFV",
"nimi" => "Lapin AVI",
"til_vuosi" => 2020,
"vaesto" => 176665,
"vaesto_p" => 3.2,
"vuosi" => 2021
},
"type" => "Feature"
}
]
},
"encoding" => %{"color" => %{"field" => "properties.naiset", "type" => "quantitative"}},
"height" => 400,
"mark" => "geoshape",
"projection" => %{"type" => "mercator"},
"width" => 400
}
Any ideas what can be going wrong?
Thanks for your time and I appreciate any help!
Thanks!
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
I’m trying to set up Emacs with elixir-ls via lsp-mode and credo via Flycheck. This should mostly be preconfigured as Flycheck picks up c...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixirconf-us
- #elixir-ls
- #ai
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming









