[mapserver-users] Reading KML

Eichner, Andreas - SID Andreas.Eichner at sid.sachsen.de
Mon Mar 9 07:45:24 PDT 2015


You need use the special field OGR_GEOMETRY to filter by geometry type.

With ogrinfo this can be done as follows:

$ ogrinfo -al test.kml -where "OGR_GEOMETRY='LINESTRING'"
$ ogrinfo -al test.kml -where "OGR_GEOMETRY='POINT'"

Not sure how to translate this into mapfile syntax. May be using LAYER.FILTER, LAYER.DATA or (on MapServer 7.0) PROCESSING_OPTION "NATIVE_FILTER".
Using FILTER might not work due to MapServer blocking the "virtual" attribute...

LAYER
	TYPE POINT
	...
	FILTER "('[OGR_GEOMETRY]' == 'POINT')"
	...
END

Or

LAYER
	TYPE POINT
	...
	DATA "SELECT * FROM 'Fibertech solution' WHERE OGR_GEOMETRY='POINT'"
	...
END

Or

LAYER
	TYPE POINT
	...
	PROCESSING_OPTION "NATIVE_FILTER=OGR_GEOMETRY='POINT'"
	...
END


HTH


More information about the MapServer-users mailing list