I want to know what a function is doing.
The function can be found here:
I have a dataframe which have columns with type “Shapefile”. So I guess it is not easy to share it here. But it looks like this:
THESE ARE THE LIBRARIES BEING USED
THIS IS THE FUNCTION IN CODE
# 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]))
THIS IS MY ATTEMPT
for row in df_x
c = compose(c,compose(canvas(template),ESRI2Compose(row["x1"]),
The goal is to apply that function to column “x1”
When iterating over rows you should use
for row in eachrow(df_x)
Now I get this error:
Is it possible to use ONLY the ESRI2Compose function?
Something like this:
for row in eachrow(df_x)
c = ESRI2Compose(row["x1"])
But I get this error:
Your example is not an MWE (see Please read: make it easier to help you), but it looks like you’re calling
compose(c, ...) in your loop without first defining
It might be useful to have a look at the Julia language docs and maybe the documentation for the packages you’re using to get the hang of the basic usage, as step-by-step debugging via Discourse might be pretty time consuming…
But I cannot give a dataframe with type “Shapefile”
Not sure I understand - do you mean in terms of an MWE? There are many shapefiles available freely online, or you could equally just create a shapefile object manually in an MWE.
Well, if I write the dataframe i get a “string” type instead of a “shapefile”
df_mwe = DataFrame(MBR=["Rect(-80.1133, 43.5557, -79.9648, 43.7129)"])
Currently none of the errors you encountered were related to actual shapefiles, so any DataFrame would have worked as an MWE. If you absolutely need a shapefile for the MWE you could either read it in from a publicly available URL or construct one using the constructor in the relevant package (I don’t work with shapefiles so wouldn’t know what this is, but above you are getting a
"a" constructs a String, you would probably need something like
ShapeFile(-80.1133, 43.5557, -79.9648, 43.7129) but the form of the constructor will depend on the package you’re using)
I thought you needed me to give a shapefile for the MWE. I already have my shapefile in a dataframe.
Anyways I am currently using VegaLite. So I converted my shapefile to a topojson. The conversation is here: https://discourse.julialang.org/t/how-to-make-vegalite-read-my-topojson-file/34546/10