Giter Club home page Giter Club logo

turf-buffer's People

Contributors

deniscarriere avatar jseppi avatar lyzidiamond avatar mdwragg avatar morganherlocker avatar tcql avatar tmcw avatar zdavkeos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

turf-buffer's Issues

How do I get the coordinates of the selected elements?

How do I get the coordinates of the selected elements?
now,I want to select a feature,and give it radius,so i asked everyone how i obtain the feature coordinates when my pointer select a feature,sorry ,it is my first time to ask question ,and i am a chinese

Buffering a large FeatureCollection of points only includes some of the points?

I tried using turf-buffer to get a buffer around a FeatureCollection of about 1800 points:

screen shot 2015-02-10 at 11 20 15 am

var buffered = turf.buffer(
    points,
    0.25,
    "miles"
  );

The buffer result only seems to have incorporated a fraction of the points.

screen shot 2015-02-10 at 11 20 30 am

If I manually buffer EACH point feature individually, and then merge all the resulting polygons, it does incorporate them all:

var individuallyBuffered = turf.merge({
  "type": "FeatureCollection",
  "features": points.features.map(function(feature){
    return turf.buffer(feature,0.25,"miles").features[0];
  })
});

Pink is the results from one-by-one buffering and green is the result from buffering the whole collection:

screen shot 2015-02-10 at 11 32 42 am

Something I'm missing about how this is supposed to work?

This is the original GeoJSON of points:

https://gist.github.com/veltman/35209c89318be09dee33

Buffered result loses a polygon from a MultiPolygon

The following code shows a bug, where the original feature collection contains a multipolygon with two shapes, but the resulting buffered output only has one of those polygons

var pt = {
  "type": "FeatureCollection",
  "features": [{
    "type": "Feature",
    "properties": {},
    "geometry": {
      "type": "MultiPolygon",
      "coordinates": [
        [
          [
            [-122.28068729011625, 37.533846],
            [-122.321643, 37.533846],
            [-122.34964211167777, 37.533846],
            [-122.3221531, 37.5477641],
            [-122.3004556, 37.55875],
            [-122.28068729011625, 37.533846]
          ]
        ],
        [
          [
            [-122.39372234835123, 37.533846],
            [-122.519032, 37.533846],
            [-122.519464, 37.534918],
            [-122.519755, 37.545632],
            [-122.39372234835123, 37.533846]
          ]
        ]
      ]
    }
  }]
};

var unit = 'meters';
var buffered = turf.buffer(pt, 20, unit);

//=result

How to create three-dimensional Mode buffer?

I have one 3d model Object
[
// Triangle A
-90.6714, 35.9641, 322.543, -94.6717, 38.9642, 325.51, -97.6717, 35.9639, 324.724,
// Triangle B
-94.6717, 30.9639, 324.717, -90.6717, 32.9639, 324.724, -94.6717, 34.9639, 324.719
]

I explain it and vertical points are below:
-90.6714, 35.9641, 322.543,
-94.6717, 38.9642, 325.51
-97.6717, 35.9639, 324.724
-94.6717, 30.9639, 324.717
-90.6717, 32.9639, 324.724
-94.6717, 34.9639, 324.719

Please tell me Great turf can handle with it ?(3d model buffer)

Unknown GeoJSON type: undefined

I am trying to check features drawn using OL 3 for intersections. Features are all lineStrings.
I use the following code where i get the Unknown GeoJSON type error:

lineStringdraw.on('drawend', function(e2) {
var featureEnd = e2.feature;
checkIntersection(featureEnd);
});

function checkIntersection(currentFeature){
var features = vectorLayer.getSource().getFeatures();
var geoJSON = new ol.format.GeoJSON();
geoJSON = geoJSON.writeFeature(currentFeature);
for (i=0; (features.length)>i;i++){
var feature = features[i];
geoJSON_i = geoJSON.writeFeature(feature);
var intersectionStatus = turf.intersect(geoJSON,geoJSON_i);
$('#infoList').append(intersectionStatus);
}
}

here is piece of the OL3 GeoJSON:
{"type":"Feature","geometry":{"type":"LineString","coordinates":[[-8236104.129670544,4977029.890789877],[-8236634.411554272,4974407.145256842]]},"properties":null}

comparing to the turf standard, they pretty much look the same except the turf uses single quotations instead. Shouldn't they be compatible as long as both follow the same standard as GeoJSON? Or am I missing something here?

How to get LineString from Polygon reducing the applied buffer value

Hi,

I created a buffered polygon for a LineString segment using:
// featureGeoJson below is a LineString feature drawn on the map
const bufferedPolygon = turf.buffer(featureGeoJson, bufferVal, 'kilometers')

Is there any way I can process back LineString from the now available bufferedPolygon and bufferVal?

Note: featureGeoJson is not saved anywhere in our app now.

Smallest buffer ratio

Looks like it does not accept Number.MIN_VALUE as ratio...

My tests gives me 10^-9 as smallest value

turf.buffer Distances don't seem to match turf.distance

I computing a 25km-75km buffer in eastern Europe. On a 75km buffer turf.distance calculates a point as 60km away but the buffer of 75km does not extend to include the point. I am supplying unit='kilometers' to both. My database which uses sloppyarc seems to agree more with turf.distance. Do these two methods use different distance calculations? It's not documented what buffer uses as an algorithm only that turf.distance uses haversine. I am more concerned about consistency (For UX presentation) than complete accuracy.

jsts ignoring multiple holes

var buffered = turf.buffer({
      "type": "Feature",
      "properties": {},
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              -1.0052490234375,
              38.248965760244644
            ],
            [
              -1.68365478515625,
              38.06539235133249
            ],
            [
              -1.71112060546875,
              37.57723579111111
            ],
            [
              -0.626220703125,
              37.45741810262938
            ],
            [
              -0.70587158203125,
              37.98966904403617
            ],
            [
              -1.0052490234375,
              38.248965760244644
            ]
          ],
          [
            [
              -1.10687255859375,
              38.052416771864834
            ],
            [
              -1.329345703125,
              38.037275688165614
            ],
            [
              -1.37054443359375,
              37.79676317682161
            ],
            [
              -1.1700439453125,
              37.785910776551354
            ],
            [
              -1.10687255859375,
              38.052416771864834
            ]
          ],
          [
            [
              -0.9365844726562499,
              37.92686760148135
            ],
            [
              -1.03271484375,
              37.83364941345968
            ],
            [
              -0.94482421875,
              37.80327385185868
            ],
            [
              -0.9365844726562499,
              37.92686760148135
            ]
          ]
        ]
      }
    },
2, 'miles');

in

out

Update readme

Needs to be updated, since it's not inline with the code comments.

Circular Buffer - and not an elliptical

This is known issue in many other programs as well (mySql for example)
I'm well aware of the Geographic Vs UTM measurement problem.
Example of a buffer of 1 miles using turf-buffer & turf distance.
buffer2

Unable to Buffer on FeatureCollection of MultiPolygons

When trying to buffer on a FeatureCollection of MultiPolygons(this file), the current Buffer code (turf-buffer v1.0.1 used by turf v2.0.2) prepares the data by running it through combine. If the FeatureCollection's first feature's geometry type (fc.features[0].geometry.type) is "MultiPolygon", no geometry property is appended to the FeatureCollection during the combine operation. When the bufferOp later passes a stringified version of feature.geometry (which is undefined) to an instance of jsts.io.GeoJSONReader, the error Uncaught TypeError: Cannot read property 'type' of undefined is thrown. Based on my reading of the GeoJSON Feature Collection Objects spec, it is not invalid for a FeatureCollection object to not have a geometry property on the root of the object.

This bug appears to have been fixed with this committed change, so this issue can likely be tagged wont fix. I'm more interested in created this issue so that:

  1. It can be logged as a known issue for users of turf v2.0.2 and any other turf versions relying on turf-buffer v.1.0.1.
  2. Propose that a subset of that test file make it's way into a test fixture (likely within turf-combine)
  3. Enquire as to when turf-buffer >v1.0.1 (the repo appears to be at v1.0.4 at this moment) will be rolled into a main version of turf.

Buffered results missing properties for features

First I found out the hard way that the default version of turf-buffer inside turf is an old one, which is buggy. After locally installing the latest version (1.1.0) of turf-buffer I'm getting much better results. But I spotted a bug around properties.

Line 75 of index.js has:
properties: {}

which should be:
properties: feature.properties

turf.buffer creates Polygons with clockwise vertices.

I'm using the CDN version of turf in my browser, and creating buffers for User provided points, and saving them in the db; I realized that the geojson created was not conforming to the GeoJSON standard, (section 3.16) specifically, which states that

A linear ring MUST follow the right-hand rule with respect to the
area it bounds, i.e., exterior rings are counterclockwise, and
holes are clockwise.

This can be replicated by running the following code:

var pt=turf.point([73,20]);
var buff=turf.buffer(pt, 2000, 'meters');
console.log(JSON.stringify(buff));

And then testing the output with http://geojsonlint.com/

Error in the radius of buffer

Working with turf.buffer I notice that the buffering figure of a Polygon was not correct.
In particular, the radius (expressed in meter) wasn't respected during the dilatation.

I report below a test done for buffer a point.
(I know that there is turf.circle but i want to demonstrate the error for the radius).

point used -->"coordinates": [ 7.237860560417174, 45.12233909279541];
Code:

   p = turf.buffer(point, 50, {units:'meters'});
   console.log(turf.area(p));

Console:

  3885.60

Check resultant area:
3885.60=image* R² --> R=35.17m

So,the radius doesn't match the radius of the function.
(It was acceptable if the area was higher for the terrestrial curvature)

With other test, i find out that using radius=71.1 with 'meters', the area after buffer is 7857.98mq and R=50.01m with the formula used before.

Using [email protected]

thanks

union flag

dissolve the results from a multi-geometry buffer

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.