Coder Social home page Coder Social logo

Comments (5)

geographika avatar geographika commented on May 29, 2024 1

This seems a useful enhancement to me. From https://mapserver.org/mapfile/template.html#general

nullformat = String to output if the attribute value is NULL, empty or doesn’t match the pattern (if defined). If not set and any of these conditions occur the item tag is replaced with an empty string.

So nullformat is already used for a couple of cases - both NULL values and values that don't meet a regex, so could be expanded to missing fields. The downside would be possibly breaking backwards compatibility with current templates - although as noted in this issue if a field is missing the template would be throwing an error.

from mapserver.

geographika avatar geographika commented on May 29, 2024 1

Implemented with #7017 and docs at MapServer/MapServer-documentation#873

from mapserver.

sdlime avatar sdlime commented on May 29, 2024

This seems a useful enhancement to me. From https://mapserver.org/mapfile/template.html#general

nullformat = String to output if the attribute value is NULL, empty or doesn’t match the pattern (if defined). If not set and any of these conditions occur the item tag is replaced with an empty string.

So nullformat is already used for a couple of cases - both NULL values and values that don't meet a regex, so could be expanded to missing fields. The downside would be possibly breaking backwards compatibility with current templates - although as noted in this issue if a field is missing the template would be throwing an error.

Perhaps setting an item-level attribute to ignore a missing item - potentially paired with the nullformat - would be a way to avoid backwards compatibility issues.

from mapserver.

geographika avatar geographika commented on May 29, 2024

Perhaps setting an item-level attribute to ignore a missing item - potentially paired with the nullformat - would be a way to avoid backwards compatibility issues.

@sdlime - sounds good to me. What about an ignoremissing property, which can take a "true" value, to ignore missing fields, and if the field is missing it populates the template with the nullformat value e.g.

<!-- MapServer Template -->
Band 1: [value_0]<br/>
[item name="value_1" format="Band 2: $value" nullformat="" ignoremissing="true"]<br/>

from mapserver.

sdlime avatar sdlime commented on May 29, 2024

Yeah, that's what I was thinking. I can't think of a more concise name...

from mapserver.

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.