@fugwenna I think I tried that without success.
I need to check if points and linestrings are within a polygon.
I ended up using this: http://turfjs.org/docs#booleanPointInPolygon
And a hack to make each end of a linestring become a point.
The draback is that I need to check thousands of points, one at a time, with a loop.
Hey all, Im looking for answer for this question https://stackoverflow.com/questions/49645333/turfjs-linesplit-not-working-properly-when-splitter-is-near-vertex-point
I really need a help at the moment.
Thanks in advanced
Hi all. I need to count how many occurences (point) in a set of polygons by remarking the each occurences property in polygon.
The polygon is:
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"id": 0,
"properties": {
"id": 1,
"occurences": 0
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
109.914952,
-7.19584
],
[... about 50.000 nodes ...]
]
]
}
},
[... less than 100 polygons ...]
]
}
and the points:
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"id": 0,
"properties": {
"id": 1
},
"geometry": {
"type": "Point",
"coordinates": [
109.912194,
-7.711743
]
}
},
[... about 20.000 points ...]
]
}
In Turf.js, I believe I can do it with pointsWithinPolygon or booleanPointInPolygon. My questions are: which is faster/efficient? How to do it?
Much obliged for your attention.
turf.along
but opposite, i mean, i have a line, and 2 points on it, i need to get the distance between these points?
Hi there, thanks for the great work, though I don't get the squareGrid:
var squarebin = squareGrid([0,0,2,2], 1, {units: 'degrees'});
Gives me {"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[0.49941580254182905,0.49941580254182905],[0.49941580254182905,1.500584197458171],[1.500584197458171,1.500584197458171],[1.500584197458171,0.49941580254182905],[0.49941580254182905,0.49941580254182905]]]}}]}
Why it does not give me four Features starting from 0,0? Am I missing something?
Unknown GeoJSON type: undefined
because one of the data inputs is vector tiles. I found a question on this back in 2016, but looking for a current answer/resource that will help me learn a) whether I need to convert the vt to geojson and b) best method for doing this client side. Maybe the best answer is to just use a geojson source to begin with?