Hi Jukka, You were right about that is possible to calculate length of a line in a KML file in Mapserver via ogr and sqlite. It is possible with a VRT file. I had some weekend fun learning. This will be useful in another project I am doing!
The only trouble I found, was that I could not get the relativeToVRT=1 to work when I did an inline specification of the ovf in the mapfile. The only way to get the inline ScrDataSource specification to work was to use a full path description to the kml file location. In most cases I like to use relative location specifications. Shapepath specification in the mapfile didn’t help /Lars Example follows: Make a ovf-file: doc_test.ovf <OGRVRTDataSource> <OGRVRTLayer name='doc_test'> <SrcDataSource relativeToVRT=1>./doc_test.kml</SrcDataSource> <SrcSQL dialect='sqlite'> select geometry, Name, cast(OGR_STYLE as chartater(32)) as 'LINE_STYLE', cast(ST_length(geometry, 4857) as integer(12)) as 'DISTANCE' FROM 'Fibertech solution' where ST_GeometryType(geometry) LIKE 'LINESTRING%'</SrcSQL> </OGRVRTLayer> </OGRVRTDataSource> The class from the new mapfile. LAYER CONNECTIONTYPE OGR CONNECTION "doc_test.ovf" DATA 'doc_test' NAME "kml_example" GROUP LINES TYPE LINE STATUS ON CLASSITEM "LINE_STYLE" CLASS EXPRESSION "@msn_ylw-pushpin4" STYLE COLOR 250 0 0 WIDTH 2.5 END LABEL TEXT ("Distance: " + '[DISTANCE]' + ' meters ' + '#' + '[Name]') WRAP '#' SIZE MEDIUM COLOR 255 100 100 POSITION AUTO END END …….
_______________________________________________ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users