1

I'm trying to display features with different geometry types in single LAYER. MapServer version 7.0.1 (MS4W 3.1.4). The data source is MS SQL spatial database table with geometry column, containing Point and Polygon geometry type features (all with the same SRID).

Here is most significant lines from LAYER configuration:

LAYER
 NAME "stations"

 CONNECTIONTYPE PLUGIN
 PLUGIN "msplugin_mssql2008.dll"
 CONNECTION "Server=.\DB1;uid=***;pwd=***;Database=***;Integrated Security=True"
 DATA "Geom FROM [Stations] USING UNIQUE Id USING SRID=3785"

 TYPE polygon
 #TYPE point
 CLASS
 ...
 END
END

I can define two CLASS declarations with corresponding EXPRESSION to filter by geometry type in .map file but the TYPE declaration is still required, omitting it gives loadLayer(): General error message. Layer type not set. error.

Is it possible to do using MapServer or defining separate LAYERs for each geometry type is the only option ?

1
  • Most styles are connected to points/lines/polygons and for example if polygon data is set to TYPE LINESTRING then it is not possible to render polygon fill. Defining separate layers will certainly work with WMS but perhaps single layer could work in WFS service.
    – user30184
    Sep 15 at 8:09
1

Historically, MapServer was based on shapefiles, and thus still has the restriction that a single layer can draw only one geometry type.

If you want to draw both points and polygons, you need two layers.
(And you need to use queries to filter out the wrong geometries, because MapServer will happily draw the polygon nodes as points. Use something like STDimension.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.