I a new user of the geo-tools in general, not only within the Julia ecosystem and I am trying to sample randomly from a LINESTRING LibGEOS geometry but the only function that seemed potentially useful is pointOnSurface. However it does not sample. I am aware of the function in Python: geopandas.GeoSeries.sample_points and I was curious whether something like this existed in Julia or otherwise whether someone with experience in this environment could provide efficient ways of doing so adapted to the current exported function by LibGEOS.jl

Using Meshes.jl you should be able to do something like

using Meshes
# Construct a rope of line segments (a - b - c)
a = Point(...)
b = Point(...)
c = Point(...)
linestring = Rope(a, b, c)
# Uniform random sampling
n_sample_points = ...
sampler = HomogeneousSampling(n_sample_points)
points = collect(sample(linestring, sampler))

@miguelborrero if you are not tied to these external C libraries, I highly recommend the GeoStats.jl stack (superset of Meshes.jl) for geospatial data science. You can do much more and we are here to help with quick bug fixes.

Thanks for the pointer. Quick question to assess feasibility of the move? Can I export LibGEOS geometries or define polygons easily from vector of coordinate pairs in this library? That would be awesome.

I mean like: I have a vector of (x,y) coordinates which I read from a shapefile and I want to form a polygon geometry using these points as vertices and then calculate the area or sample within the polygon etc?

Thanks for the book link and sorry that Im being a bit lazy here but I need to do the task urgently and therefore want to assess the use as quickly as possible.