[mapserver-users] KML reading through OGR

Schylberg Lars lars.schylberg at saabgroup.com
Wed Mar 11 06:08:59 PDT 2015


The OGR style is the variable that is returned in the variable that is casted.
Please look at the Layer definitions that I sent yesterday in the mapfile example.


DATA "SELECT Name as NAME, CAST(OGR_STYLE AS character(32)) AS STYLE FROM 'Fibertech solution' WHERE OGR_GEOMETRY='LINESTRING'"

CLASSITEM "STYLE"

LABELITEM "NAME"



CLASS

     EXPRESSION "@msn_ylw-pushpin4"


That is the STYLE value used in the CLASSITEM expression.

The description is shown in the label that uses the labelitem.  Also shown in the mapfile example yesterday.


If You only want to get the features with the style ‘@msn_ylw-pushpin4' with ogrinfo you should write it like this:

ogrinfo -ro doc_test.kml \
-sql "SELECT *, CAST(OGR_STYLE AS character(255)) AS STYLE FROM 'Fibertech solution' \
WHERE OGR_GEOMETRY='LINESTRING' AND OGR_STYLE='@msn_ylw-pushpin4'" –al

That returns the geometry and variables according to this criteria, i.e. only lines and specific style.

But I guess that You most likely would like to do this filtering in the Class section of the mapfile and not in the DATA statement.

/Lars


From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of alok mathur
Sent: den 11 mars 2015 05:46
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] KML reading through OGR

Hi,

I am unable to get the Styleurl using Ogrinfo. I am trying the command
ogrinfo -al doc_test.kml -where "ogr_style='@msn_ylw-pushpin4'"

but the result is
Layer name: Fibertech solution
Geometry: 3D Unknown (any)
Feature Count: 0
Layer SRS WKT:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        TOWGS84[0,0,0,0,0,0,0],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0,
        AUTHORITY["EPSG","8901"]],
    UNIT["degree",0.0174532925199433,
        AUTHORITY["EPSG","9108"]],
    AUTHORITY["EPSG","4326"]]
Name: String (0.0)
Description: String (0.0)



Also i want to show the description of placemark on map.

Thanks!
[https://ssl.gstatic.com/ui/v1/icons/mail/images/cleardot.gif]

--

Alok Mathur | Software Engineer 2A | Ciena
Mobile +91 9899413266
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20150311/a731a62d/attachment.html>


More information about the mapserver-users mailing list