Git Product home page Git Product logo

Comments (16)

mh-geus-dk avatar mh-geus-dk commented on May 31, 2024 1

Dear Renata,
Could you please send me the GeoPackage so we can do some testing?
Cheers Martin

from project-support-wp8.

renatabarros avatar renatabarros commented on May 31, 2024 1

Many thanks for trying different solutions, James! It's very frustrating that nothing works.

Meanwhile I have found a way to work around it (snapshot below) by doing the following:

  • Simbolise the layer based on one single field & save style on the gpkg
  • Upload in EGDI applying this simbolisation => works!
  • Apply filters to display the data as I want, so e.g. the linetype can be separated into two categories "Certain" (value=0) and "Uncertain" (value=1) => still couldn't make it work properly, probably because this field is numeric, but still something I can fix in the data to be delivered

So good news is that the simbolisation based on a single field can be imported with no problems, which I think discards a problem with the dataset itself. But still to be figured out why custom styles are not working OK.

image

from project-support-wp8.

nmtoken avatar nmtoken commented on May 31, 2024 1

These all work to give styles in the previewer:

By linetype only:

CLASS
    NAME "R2R_Limits"
   # dummy expression has no matches
    EXPRESSION ([linetype] = -1)
    STYLE
        # Omit COLOR RGB for no colour
    END
END
CLASS
    EXPRESSION ([linetype] = 0 )
    STYLE
        COLOR "#208719"
        WIDTH 1
        LINEJOIN bevel
    END
    TITLE "type 0"
END
CLASS
    EXPRESSION ([linetype] = 1 )
    STYLE
        "COLOR  "#eb0c23"
        WIDTH 1
        LINEJOIN bevel
    END
    TITLE "type 1"
END

By "category" only

    CLASS
        NAME "R2R_Limits"
        # dummy expression has no matches
        EXPRESSION ("[category]" = "")
        STYLE
            # Omit COLOR RGB for no colour
        END
    END
    CLASS
        EXPRESSION ("[category]" = "Contact")
        STYLE
            COLOR "#000004"
            WIDTH 1
            LINEJOIN bevel
        END
        TITLE "Contact"
    END
    CLASS
        EXPRESSION ("[category]" = "Crustal boundary")
        STYLE
            COLOR "#208719"
            WIDTH 1
            LINEJOIN bevel
        END
        TITLE "Crustal boundary"
    END
    CLASS
        EXPRESSION ("[category]" = "Fault")
        STYLE
            COLOR "#eb0c23"
            WIDTH 1
            LINEJOIN bevel
        END
        TITLE "Fault"
    END
    CLASS
        EXPRESSION ("[category]" = "Lineament")
        STYLE
            COLOR "#3cf03c"
            WIDTH 1
            LINEJOIN bevel
        END
        TITLE "Lineament "
    END
    CLASS
        EXPRESSION ("[category]" = "Orogenic front")
        STYLE
            COLOR "#35e1ed"
            WIDTH 1
            LINEJOIN bevel
        END
        TITLE "Orogenic front"
    END
    CLASS
        EXPRESSION ("[category]" = "Plate boundary")
        STYLE
            COLOR "#280c99"
            WIDTH 1
            LINEJOIN bevel
        END
        TITLE "Plate boundary"
    END
    CLASS
        EXPRESSION ("[category]" = "Unconformity")
        STYLE
            COLOR "#b540df"
            WIDTH 1
            LINEJOIN bevel
        END
        TITLE "Unconformity"
    END

By linetype and "category"

CLASS
    NAME "R2R_Limits"
   # dummy expression has no matches
    EXPRESSION ([linetype] = -1)
    STYLE
        # Omit COLOR RGB for no colour
    END
END
CLASS
    EXPRESSION ([linetype] = 0 AND "[category]" = "Contact")
    STYLE
        COLOR "#000004"
        WIDTH 1
        LINEJOIN bevel
    END
    TITLE "Contact 0"
END
CLASS
    EXPRESSION ([linetype] = 1 AND "[category]" = "Contact")
    STYLE
        PATTERN 2 7 END
        COLOR "#000004"
        WIDTH 1
        LINEJOIN round
    END
    TITLE "Contact 1"
END
CLASS
    EXPRESSION ([linetype] = 0 AND "[category]" = "Crustal boundary")
    STYLE
        COLOR "#208719"
        WIDTH 1
        LINEJOIN bevel
    END
    TITLE "Crustal boundary 0"
END
CLASS
    EXPRESSION ([linetype] = 1 AND "[category]" = "Crustal boundary")
    STYLE
        PATTERN 2 7 END
        COLOR "#208719"
        WIDTH 1
        LINEJOIN round
    END
    TITLE "Crustal boundary 1"
END
CLASS
    EXPRESSION ([linetype] = 0 AND "[category]" = "Fault")
    STYLE
        COLOR "#eb0c23"
        WIDTH 1
        LINEJOIN bevel
    END
    TITLE "Fault 0"
END
CLASS
    EXPRESSION ([linetype] = 1 AND "[category]" = "Fault")
    STYLE
        PATTERN 2 7 END
        COLOR  "#eb0c23"
        WIDTH 1
        LINEJOIN round
    END
    TITLE "Fault 1"
END
CLASS
    EXPRESSION ([linetype] = 0 AND "[category]" = "Lineament")
    STYLE
        COLOR "#3cf03c"
        WIDTH 1
        LINEJOIN bevel
    END
    TITLE "Lineament 0"
END
CLASS
    EXPRESSION ([linetype] = 1 AND "[category]" = "Lineament")
    STYLE
        PATTERN 2 7 END
        COLOR "#3cf03c"
        WIDTH 1
        LINEJOIN round
    END
    TITLE "Lineament 1"
END
CLASS
    EXPRESSION ([linetype] = 0 AND "[category]" = "Orogenic front")
    STYLE
        COLOR "#35e1ed"
        WIDTH 1
        LINEJOIN bevel
    END
    TITLE "Orogenic front 0"
END
CLASS
    EXPRESSION ([linetype] = 1 AND "[category]" = "Orogenic front")
    STYLE
        PATTERN 2 7 END
        COLOR "#35e1ed"
        WIDTH 1
        LINEJOIN round
    END
    TITLE "Orogenic front 1"
END
CLASS
    EXPRESSION ([linetype] = 0 AND "[category]" = "Plate boundary")
    STYLE
        COLOR "#280c99"
        WIDTH 1
        LINEJOIN bevel
    END
    TITLE "Plate boundary 0"
END
CLASS
    EXPRESSION ([linetype] = 1 AND "[category]" = "Plate boundary")
    STYLE
        PATTERN 2 7 END
        COLOR "#280c99"
        WIDTH 1
        LINEJOIN round
    END
    TITLE "Plate boundary 1"
END
CLASS
    EXPRESSION ([linetype] = 0 AND "[category]" = "Unconformity")
    STYLE
        COLOR "#b540df"
        WIDTH 1
        LINEJOIN bevel
    END
    TITLE "Unconformity 0"
END
CLASS
    EXPRESSION ([linetype] = 1 AND "[category]" = "Unconformity")
    STYLE
        PATTERN 2 7 END
        COLOR "#b540df"
        WIDTH 1
        LINEJOIN round
    END
    TITLE "Unconformity 1"
END

from project-support-wp8.

renatabarros avatar renatabarros commented on May 31, 2024 1

Yes, it works! Thank you very much!

from project-support-wp8.

bgsmase avatar bgsmase commented on May 31, 2024

@mh-geus-dk did you get the GeoPackage and, if so, what were the results of testing?

from project-support-wp8.

renatabarros avatar renatabarros commented on May 31, 2024

Hello all,

Since Martin H ran some tests I have since uploaded a few datasets with thematisation successfully. However, when testing thematisation based on multiple fields (in this case different colours based on "category", and solid or dashed line based on "lineType") the upload works but the thematisation does not. I attach two figures to show (1) the geopackage when opened in QGIS, and when (2) uploaded to EGDI.

Thanks in advance for the help with this issue!

(1)
qgis-with-theme

(2)
upload-no-theme

from project-support-wp8.

nmtoken avatar nmtoken commented on May 31, 2024

what does your mapfile / configuration look like

from project-support-wp8.

nmtoken avatar nmtoken commented on May 31, 2024

I think you'll have to write your own class expressions to cater for your data. Documentation to follow for the expression syntax would be: https://mapserver.org/mapfile/expressions.html and styling at https://mapserver.org/mapfile/style.html

Something along the lines of:

    CLASS
        # Dummy for legend title
        NAME "R2R_Limits"
        EXPRESSION ""
        STYLE
            COLOR 255 255 255
        END
    END
    CLASS
        EXPRESSION ([lineType] = 0 AND "[category]" = "contact")
        STYLE
            PATTERN 3 3 END
            COLOR 0 0 0
            WIDTH 3
        END
        TITLE "Contact0"
    END
    CLASS
        EXPRESSION ([lineType] = 1 AND "[category]" = "contact")
        STYLE
            COLOR 0 0 0
            WIDTH 3
        END
        TITLE "Contact1"
    END

from project-support-wp8.

renatabarros avatar renatabarros commented on May 31, 2024

Hi James, many thanks for the answer!

I tried the following, however nothing changes on the map. Any idea what could be going wrong?

LAYER
NAME "r2r_limits"
GROUP "egdi"
TYPE Line
STATUS on
METADATA
"ows_title" "R2R_Limits"
"ows_abstract" "Auto generated data set"
"ows_group_title" "EGDI"
"ows_group_abstract" "EGDI"
"gml_featureid" "ogc_fid"
"ows_featureid" "ogc_fid"
"ows_include_items" "all"
"gml_include_items" "all"
"gml_types" "auto"
"ows_srs" "EPSG:3034"
"gml_geometries" "msGeometry"
"gml_msGeometry_type" "Line"
"dataset_path" "/egdi/shared/datasets/geoconnect3d/r2r-test_20210923_115611.gpkg"
"ows_extent" "-2282444.215297565 807382.9210737981 7502521.740010923 8573455.250498675"
"wms_style" "default"
"wms_style_default_legendurl_href" "/egdi/get_legend.jsp?layer=10538"
"wms_style_default_legendurl_format" "image/png"
"wms_style_default_legendurl_height" "250"
"wms_style_default_legendurl_width" "250"
"ows_inspire_capabilities" "url"
"ows_inspire_metadataurl_format" "application/xml"
"ows_inspire_metadataurl_href" "https://egdi.geology.cz/record/basic/601975f9-9624-4131-8e70-20720a010833"
"ows_metadataurl_format" "text/xml"
"ows_metadataurl_href" "https://egdi.geology.cz/record/basic/601975f9-9624-4131-8e70-20720a010833"
"ows_metadataurl_type" "TC211"
END
HEADER "templates/wms_header.html"
TEMPLATE "templates/std_template.html" # Otherwise not queryable
FOOTER "templates/wms_footer.html"
CONNECTIONTYPE POSTGIS
CONNECTION "host=localhost dbname=egdi user=gis_viewer password=view2Qis port=5432"
DATA "wkb_geometry FROM (SELECT * FROM project_geoconnect3d.r2rlimits_20210923_115611) AS t USING UNIQUE ogc_fid SRID 3034 FILTER"
LABELCACHE on
CLASS
NAME "R2R_Limits"
EXPRESSION ""
STYLE
COLOR 255 255 255
END
END
CLASS
EXPRESSION ([Linetype] = 0 AND "[Category]" = "Contact")
STYLE
PATTERN 5 5 END
COLOR 0 102 204
WIDTH 3
END
TITLE "Contact0"
END
CLASS
EXPRESSION ([Linetype] = 1 AND "[Category]" = "Contact")
STYLE
COLOR 0 0 0
WIDTH 3
END
TITLE "Contact1"
END
END
END
PROJECTION
"init=epsg:3034"
END
END

from project-support-wp8.

nmtoken avatar nmtoken commented on May 31, 2024

You may check that the attribute names now in PostGIS are still called Linetype and Category, I think that when you ingest into PostGIS by default all attribute names are changed to lowercase, so they may now be linetype and category.

Also check that the values of your attribute linetype are integers and not strings, if strings the expression would change from [Linetype] = 0 to "[Linetype]" = "0"

from project-support-wp8.

renatabarros avatar renatabarros commented on May 31, 2024

I tried with caps, without caps... nothing works.

I also tried to upload a new gpkg and add the following instead (copying from the styling of one HOVER point shapefile: Data set hover_wp3_t35_layer3)

DATA "wkb_geometry FROM (SELECT *,
CASE
WHEN f.category IN ('Contact') THEN '0 0 205'
ELSE '255 255 0'
END rgb_hidden,
FROM project_geoconnect3d.gsilimits) AS t USING UNIQUE ogc_fid SRID 3034 FILTER"
LABELCACHE on
CLASS
STYLE
COLOR [rgb_hidden]
WIDTH 3.0
OPACITY 100
END
LABEL
FONT arialbold
TYPE TRUETYPE
SIZE 8
OUTLINECOLOR 175 175 175
COLOR 0 0 0
POSITION uc # upper-center
END
END
PROJECTION
"init=epsg:3034"
END
END

The lines disappear from the map (as with the code of yesterday). Any chance there is something different to do in the case of a line shapefile? Seems to work OK for points but not for lines.

from project-support-wp8.

nmtoken avatar nmtoken commented on May 31, 2024

It may not make a difference, but in your test of my suggestion... you seem to have an invalid map configuration (too many ENDs)

LAYER
    NAME "r2r_limits"
    GROUP "egdi"
    TYPE Line
    STATUS on
    METADATA
        "ows_title" "R2R_Limits"
        "ows_abstract" "Auto generated data set"
        "ows_group_title" "EGDI"
        "ows_group_abstract" "EGDI"
        "gml_featureid" "ogc_fid"
        "ows_featureid" "ogc_fid"
        "ows_include_items" "all"
        "gml_include_items" "all"
        "gml_types" "auto"
        "ows_srs" "EPSG:3034"
        "gml_geometries" "msGeometry"
        "gml_msGeometry_type" "Line"
        "dataset_path" "/egdi/shared/datasets/geoconnect3d/r2r-test_20210923_115611.gpkg"
        "ows_extent" "-2282444.215297565 807382.9210737981 7502521.740010923 8573455.250498675"
        "wms_style" "default"
        "wms_style_default_legendurl_href" "/egdi/get_legend.jsp?layer=10538"
        "wms_style_default_legendurl_format" "image/png"
        "wms_style_default_legendurl_height" "250"
        "wms_style_default_legendurl_width" "250"
        "ows_inspire_capabilities" "url"
        "ows_inspire_metadataurl_format" "application/xml"
        "ows_inspire_metadataurl_href" "https://egdi.geology.cz/record/basic/601975f9-9624-4131-8e70-20720a010833"
        "ows_metadataurl_format" "text/xml"
        "ows_metadataurl_href" "https://egdi.geology.cz/record/basic/601975f9-9624-4131-8e70-20720a010833"
        "ows_metadataurl_type" "TC211"
    END
    HEADER "templates/wms_header.html"
    TEMPLATE "templates/std_template.html" # Otherwise not queryable
    FOOTER "templates/wms_footer.html"
    CONNECTIONTYPE POSTGIS
    CONNECTION "host=localhost dbname=egdi user=gis_viewer password=view2Qis port=5432"
    DATA "wkb_geometry FROM (SELECT * FROM project_geoconnect3d.r2rlimits_20210923_115611) AS t USING UNIQUE ogc_fid SRID 3034 FILTER"
    LABELCACHE on
    CLASS
        NAME "R2R_Limits"
        EXPRESSION ""
        STYLE
            #COLOR 255 255 255 # omit for no colour
        END
    END
    CLASS
        EXPRESSION ([Linetype] = 0 AND "[Category]" = "Contact")
        STYLE
            PATTERN 5 5 END
            COLOR 0 102 204
            WIDTH 3
        END
        TITLE "Contact0"
    END
    CLASS
        EXPRESSION ([Linetype] = 1 AND "[Category]" = "Contact")
        STYLE
            COLOR 0 0 0
            WIDTH 3
        END
        TITLE "Contact1"
    END
    #END #no beginning?
    #END #no beginning?
    PROJECTION
        "init=epsg:3034"
    END
END

from project-support-wp8.

renatabarros avatar renatabarros commented on May 31, 2024

I fixed the extra ENDS and still no luck :(

I also uploaded a new gpkg with no style stored in it to see if the presence of such file could be somehow impeding manual thematisation. Still nothing happens when changing the code, but this time the colour red defined by default in CLASS does appear when first uploading (not the case with the previous gpkgs that were showing in black by default - what would be overriding the default red? no idea)

Is there any project that successfully managed to set thematisation manually to lines and/or polygons so I can take a look at their code?

from project-support-wp8.

nmtoken avatar nmtoken commented on May 31, 2024

Trying to work with the downloaded GeoPackage (r2r-test_20210923_115611.gpkg) on a local MapServer instance and I can't get it to work :( which may point to some issue with the data (or possibly just an error on my part). Looking at the layer_styles table my guess at what you would need is:

    CLASS
        NAME "R2R_Limits"
        EXPRESSION ""
        STYLE
            # Omit COLOR RGB for no colour
        END
    END
    CLASS
        EXPRESSION ([linetype] = 0 AND "[category]" = "Contact")
        STYLE
            COLOR "#000004"
            WIDTH 1
            LINEJOIN bevel
        END
        TITLE "Contact 0"
    END
    CLASS
        EXPRESSION ([linetype] = 1 AND "[category]" = "Contact")
        STYLE
            PATTERN 2 7 END
            COLOR "#000004"
            WIDTH 1
            LINEJOIN round
        END
        TITLE "Contact 1"
    END
    CLASS
        EXPRESSION ([linetype] = 0 AND "[category]" = "Crustal boundary")
        STYLE
            COLOR "#208719"
            WIDTH 1
            LINEJOIN bevel
        END
        TITLE "Crustal boundary 0"
    END
    CLASS
        EXPRESSION ([linetype] = 1 AND "[category]" = "Crustal boundary")
        STYLE
            PATTERN 2 7 END
            COLOR "#208719"
            WIDTH 1
            LINEJOIN round
        END
        TITLE "Crustal boundary 1"
    END
    CLASS
        EXPRESSION ([linetype] = 0 AND "[category]" = "Fault")
        STYLE
            COLOR "#eb0c23"
            WIDTH 1
            LINEJOIN bevel
        END
        TITLE "Fault 0"
    END
    CLASS
        EXPRESSION ([linetype] = 1 AND "[category]" = "Fault")
        STYLE
            PATTERN 2 7 END
            COLOR  "#eb0c23"
            WIDTH 1
            LINEJOIN round
        END
        TITLE "Fault 1"
    END
    CLASS
        EXPRESSION ([linetype] = 0 AND "[category]" = "Lineament")
        STYLE
            COLOR "#3cf03c"
            WIDTH 1
            LINEJOIN bevel
        END
        TITLE "Lineament 0"
    END
    CLASS
        EXPRESSION ([linetype] = 1 AND "[category]" = "Lineament")
        STYLE
            PATTERN 2 7 END
            COLOR "#3cf03c"
            WIDTH 1
            LINEJOIN round
        END
        TITLE "Lineament 1"
    END
    CLASS
        EXPRESSION ([linetype] = 0 AND "[category]" = "Orogenic front")
        STYLE
            COLOR "#35e1ed"
            WIDTH 1
            LINEJOIN bevel
        END
        TITLE "Orogenic front 0"
    END
    CLASS
        EXPRESSION ([linetype] = 1 AND "[category]" = "Orogenic front")
        STYLE
            PATTERN 2 7 END
            COLOR "#35e1ed"
            WIDTH 1
            LINEJOIN round
        END
        TITLE "Orogenic front 1"
    END
    CLASS
        EXPRESSION ([linetype] = 0 AND "[category]" = "Plate boundary")
        STYLE
            COLOR "#280c99"
            WIDTH 1
            LINEJOIN bevel
        END
        TITLE "Plate boundary 0"
    END
    CLASS
        EXPRESSION ([linetype] = 1 AND "[category]" = "Plate boundary")
        STYLE
            PATTERN 2 7 END
            COLOR "#280c99"
            WIDTH 1
            LINEJOIN round
        END
        TITLE "Plate boundary 1"
    END
    CLASS
        EXPRESSION ([linetype] = 0 AND "[category]" = "Unconformity")
        STYLE
            COLOR "#b540df"
            WIDTH 1
            LINEJOIN bevel
        END
        TITLE "Unconformity 0"
    END
    CLASS
        EXPRESSION ([linetype] = 1 AND "[category]" = "Unconformity")
        STYLE
            PATTERN 2 7 END
            COLOR "#b540df"
            WIDTH 1
            LINEJOIN round
        END
        TITLE "Unconformity 1"
    END

from project-support-wp8.

nmtoken avatar nmtoken commented on May 31, 2024

Adding r2r-test_20210923_115611.gpkg to egdi test platform, without style, get the red lines (and labels using name) and confirm doing a GetFeatureInfo request on the created WMS service (https://egditest01.geus.dk/egdi/wms/?LAYERS=r2r_limits_test&) that attribute names are lower case: linetype and category

from project-support-wp8.

nmtoken avatar nmtoken commented on May 31, 2024

I tried many options and couldn't get anything to work, even specifying classitem and trying to use just linetype or just category don't work for me. I do find it odd that we get a circle symbol as the default symbology for a line geometry type, but that's another matter...

In a related issue I've tried to update the style on an existing dataset (GeoTIFF) in the production system, using the same syntax as I was using previously, just changing the number of classes and colours, and that also fails (it was previously working), so that suggests to me that something else might be going on that prevents the application of custom style at the moment.

from project-support-wp8.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.