TransWikia.com

MapServer's UNION layer - mapfile settings to use attributes from two GeoJSON point files at the same locations?

Geographic Information Systems Asked by teknocreator on July 13, 2021

First note that we’re using MapServer 7.2.2 to display our data from AWS S3 buckets.

We’re successfully using MapServer to display point data from GeoJSON files stored in AWS S3. What we would like to do next is to use the wind speed attribute from one file and the wind direction attribute from another to create a layer that displays wind barb information at those points. We have used MapServer’s uvraster capability for a such a display but these are at grid points versus at selected locations. So, it appeared that using MapServer’s UNION layer feature could work. The UNION layer would need the speed value for determining which wind barb symbol to use and the direction value for the angle of the symbol. As a test, just displaying the speed value and attempting to rotate the text with the direction value.

While I can set up the mapfile for the UNION layer to just display values from either the speed or direction layers as a test to see if the data is being accessed from S3 correctly, I can’t seem to access both attributes within the UNION layer. Relative parts of the mapfile:

LAYER

  NAME wspdvalues #wind speed layer
  TYPE POINT
  STATUS OFF

  CONNECTIONTYPE OGR

  CONNECTION "/vsis3/bucketname/windspd_2020-09-11T00:00_2020-09-11T01:00.json"

  DATA "0"

END

LAYER

  NAME wdirvalues # wind direction layer
  TYPE POINT
  STATUS OFF

  CONNECTIONTYPE OGR

 CONNECTION "/vsis3/bucketname/winddir_2020-09-11T00:00_2020-09-11T01:00.json"
  DATA "0"
   

END

LAYER
   
NAME pointtest # union layer
TYPE POINT

STATUS DEFAULT
CONNECTIONTYPE UNION
CONNECTION "wspdvalues,wdirvalues"
PROCESSING "ITEMS=spd,dir"

CLASS
  STYLE
   COLOR 0 255 0
   SYMBOL "circle"
   SIZE 3
   MAXSIZE 6
  END
  LABEL
   TEXT (tostring([spd],"%.0f"))
   ANGLE [dir]
   OUTLINECOLOR 0 0 0
   COLOR 255 255 255
   TYPE truetype
   FONT arial-bold
   SIZE 13
   POSITION uc
   BUFFER 4
    PRIORITY [priority]
   END
  END
  PROJECTION
   "init=epsg:920910"
 END
END

Again, this is just a first test rather than using symbols at this time. If the GeoJSON file has spd and dir attributes in the same file and used in one layer, then it displays fine. As we’re displaying the data values individually, we’d rather not have to duplicate this data by combining into another file. Hence why UNION looked like it might work.

The geometry sections of each GeoJSON file are identical and in the same order. Hopefully, just missing something.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP