gm3 icon indicating copy to clipboard operation
gm3 copied to clipboard

Add doc/examples on style options

Open brentfraser opened this issue 5 years ago • 4 comments

Expand demo to show color by expression in style def:

    <map-source name="places" type="geojson" title="Cities and Villages" >
        <url>./places.geojson</url>
        <layer name="default">
            <style><![CDATA[
            {
                "fill-opacity": 0.60,
                "fill-color" : [
                  "match",
                  ["get","name"],
                  "Hastings",
                  "red",
                  "Bloomington",
                  "green",
                  "grey"
                ],
                "line-width" : 5,
                "text-field": ["get", "name"],
                "text-allow-overlap": false
            }
            ]]></style>

            <template name="identify" auto="true" />
        </layer>
    </map-source>

image

brentfraser avatar Jun 26 '20 16:06 brentfraser

I think it would also be useful to add in a comment the expected syntax (i.e. name is the field you're querying, specify the color for each city, specify a final color for any remaining cities not mentioned).

It may also be useful to show how to only display a few features (say you're connecting to a statewide dataset but are only interested in your region).

I was able to accomplish this by filtering the data and creating a layer for each feature (and then aggregating them together into a single layer in the catalog), though this can be a bit clunky.

                    <layer name="Layer 1" selectable="true">

                      <style><![CDATA[
                        {
                          "line-color" : "#002474",
                          "line-width" : 2,
                          "fill-color": "#37a800",
                          "fill-opacity": 0.20
                        }
                        ]]>
                      </style>

                      <filter><![CDATA[
                        ["==", "instName", "Lincoln County"]
                        ]]>
                      </filter>

                      <template name="identify" auto = "true" />

                    </layer>

chughes-lincoln avatar Jun 29 '20 21:06 chughes-lincoln

Good idea. Comments can be hard in our hybrid XML/CDATA/json, but perhaps a block comment showing the first object's property names and values would be helpful.

And yes, more doc on the filters.

brentfraser avatar Jun 29 '20 22:06 brentfraser

@brentfraser @chughes-lincoln please assign me I want to work on this issue..

draunger avatar Jan 09 '24 17:01 draunger

@draunger Hi! Please send an email to the Geomoose-users mailing list introducing yourself and describing your interest in GeoMoose. Thanks!

brentfraser avatar Jan 10 '24 18:01 brentfraser