turf icon indicating copy to clipboard operation
turf copied to clipboard

Coordinates are not included in the features returned by the isobands method

Open rd-atmosphericg2 opened this issue 2 years ago • 5 comments
trafficstars

There are no coordinates in the features that are returned by the isobands method. Having the coordinates would allow for labels to be placed near the isolines that are between the isobands. For example, the value for an isoline is frequently included in a plot of temperature isobands. If the coordinates were present in the returned feature, then they could be used to generate labels for the isolines as was suggested as a solution to Discussion #2404.

rd-atmosphericg2 avatar Feb 28 '23 22:02 rd-atmosphericg2

@rd-atmosphericg2 please add a snippet of code highlighting the issue

stebogit avatar Mar 01 '23 05:03 stebogit

snippet.html.gz See the console.assert statement and log statements just above that statement.

rd-atmosphericg2 avatar Mar 01 '23 17:03 rd-atmosphericg2

Hi @rd-atmosphericg2 Would you mind describing how you see this behaving in relation to the example map below? The geojson to produce this is generated from the bigMatrix test case, and can be found here.

Screenshot 2023-11-01 at 10 42 07 pm

What would you need visible on the map or available in the geojson that would meet your need?

smallsaucepan avatar Nov 01 '23 11:11 smallsaucepan

Hi @smallsaucepan , if I navigate to your "here" address, click the Code button, and examine the geojson, then I believe the geojson shows the coordinates of the polygons. The outer edges of the polygons can now be labeled with the pressure that is encapsulated in the geojson, e.g.:

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "stroke-width": 4,
        "fill-opacity": 0.4,
        "stroke": "grey",
        "fill": "grey",
        "pressure": "0-0.24"

The dark/bold blue isoline (between grey and blue polygons) represents pressure 0.24, so a label of 0.24 would be placed close to the blue isoline. The dark/bold green isoline (between blue and green polygons) represents pressure 0.5, so a label of 0.5 would be placed close to the green isoline. ... The dark/bold red isoline (between yellow and red polygons) represents pressure 2.5, so a label of 2.5 would be placed close to the red isoline.

Those labels tell the viewer what the pressure is along the isoline (along that edge of the polygon). For example, see the magenta label at the top of the graphic that appears below. The graphic is from https://origin.wpc.ncep.noaa.gov/basicwx/basicwx_ndfd.php, and the black isolines in the graphic represent mean sea level pressure. The magenta label indicates that the mean sea level pressure along that edge of the polygon is 1012 (millibars).

The placement of the labels would be done as suggested by twelch in the original discussion.

image

rd-atmosphericg2 avatar Nov 01 '23 18:11 rd-atmosphericg2

Thanks for providing that detail. So, is the crux of your problem that your data doesn't look like the test case data above? I haven't been able to get your code snippet to work. Are you able to provide a minimal code snippet (that doesn't depend on mapbox, etc)?

Perhaps post a simple snippet of code that shows the values you are passing in to the isoBands function, and the raw geojson that comes out.

smallsaucepan avatar Nov 02 '23 12:11 smallsaucepan