I did some chloropeths using Vega-Lite, which like a year back it was the only library I could find to do those. I didn’t use dataframes, as my mapping data was in TopoJSON and the counts (and other info) were in an CSV file.
The main problem is probably not VegaLite but your data format. I’m afraid that there has to be some reformating before it can be digested by VegaLite. Start with some smaller data set (for us to understand).
This is a function definition. The function is used in the next step. It seems that the function transforms Polygons between two different formats. ESRI seems to be a company and probably this is some kind of proprietary data format for polygins (just guessing here).
It would be better you find some small dataset to experiment with, maybe a subset of your data. With that you could create a MWE (Please read: make it easier to help you) and from this I could help with real VegaLite code.
I want to know how it is changing the column “x1”. Because as I inserted the .shp file in Julia I can see it in 2 ways:
a) like the one you see in image 1 (“x1”). Lets call it df_x
b) like the one you see in image 2 (“MBR”, “parts”, “points”).
Here, the columns “land_area” and “water_area” do not appear. But they are in the dataframe. Lets call it df_y
I want to know what it is doing because I think I do not need it. Why? Because I can see the dataframe in 2 ways: like df_x or df_y.
Can you help me there?
Maybe something like this:
# Going from one kind of polygon to another
ESRI2Compose(poly::Shapefile.Polygon) = Compose.FormTree(Compose.Polygon([Compose.Point(point.x,point.y) for point in poly.points]))
for row in EachRow(df_x)
c=ESRI2Compose(row["x1"][1]),
end
println(c)
I get this error:
After modifying the code to this:
for row in df_x
c = compose(c,compose(canvas(template),ESRI2Compose(row["x1"][1]),
linewidth(0.05mm),stroke(color),fill(nothing)))
end
I do not know how to send or create a dataframe with columns of type “shapefile”. So I cannot create a MWE.
Now I have started working with VegaLite.jl. It uses topojson. So I converted my .shp file to a topojson. Now I am working on ingesting that file into julia. Do you know how to do that?
I have the topojson file in my computer.
I changed my shapefile to a topojson. I am no longer using a dataframe.
I guess I will need to parse the dataframe before sending it to VegaLite. I have parsed the topojson before sending it to VegaLite.