Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

mapnik::geometry_type #180

Closed
springmeyer opened this issue Sep 13, 2012 · 15 comments · May be fixed by aravindb26/carto#3
Closed

mapnik::geometry_type #180

springmeyer opened this issue Sep 13, 2012 · 15 comments · May be fixed by aravindb26/carto#3

Comments

@springmeyer
Copy link

Mapnik 2.1 supports a new magic name to allow sorting on geometry type (mapnik/mapnik#546). A a keyword of mapnik::geometry_type is available in the expression engine as if that were an attribute on the data.

Testing now I realize that the :: conflicts with carto attachments so parsing fails.

But it can be made to work by quoting:

#countries['mapnik::geometry_type'=3] {
  polygon-fill: #fff;
}

So, this issue stands to resolve the questions: should we stick with the current name and live with needing quoting? Should it be renamed in mapnik? Should carto start being smart about not interpreting :: inside selectors as attachments? Other ideas?

/cc @artemp and @tmcw.

@kkaefer
Copy link
Member

kkaefer commented Sep 17, 2012

Theoretically, we could support the :: syntax without the quotes as well, since it's unambiguous (you're one level of [ deep and :: can only be used on the top level for attachments. However, having this syntax in addition to the attachments might create a lot of confusion, so maybe we can find a different syntax in Carto for that, e.g.

#countries[mapnik/geometry_type=3] {
  polygon-fill: #fff;
}

@tmcw
Copy link
Contributor

tmcw commented Sep 20, 2012

Y, like @kkaefer this is possible to do. I'm not sure if this syntax is the best as far as css-like-ness, could it be something like

#countries[mapnik-geometry-type=3] {
  polygon-fill: #fff;
}

This would conflict with very uncommon fields called the same, but at the same time doesn't introduce a new syntax for this.

@artemp
Copy link

artemp commented Sep 21, 2012

mapnik-geometry-type

sounds good.

@tmcw
Copy link
Contributor

tmcw commented Oct 9, 2012

Cool, ping here when it's implemented mapnik-side then we'll start thinking about making this backwards/forwards compatible

@springmeyer
Copy link
Author

Okay. Makes me realize that Mapnik-reference should likely be responsible as well for declaring these constants.

On Oct 9, 2012, at 5:47 AM, Tom MacWright notifications@github.com wrote:

Cool, ping here when it's implemented mapnik-side then we'll start thinking about making this backwards/forwards compatible


Reply to this email directly or view it on GitHub.

@strk
Copy link
Contributor

strk commented Nov 2, 2012

Can I help in any way here ? I understand the mapnik side is ready ?

@strk
Copy link
Contributor

strk commented Dec 5, 2012

@artemp, @tmcw, @springmeyer, what about the value type ? Should we aim to use symbolic names rather than (or even better in addition to) the numeric ones ? What about:

 1 == point == puntal
 2 == line == lineal
 3 == polygon == polygonal

@strk
Copy link
Contributor

strk commented Dec 5, 2012

Forget the above, seems already supported by mapnik

@springmeyer
Copy link
Author

yeah, keywords point, linestring, and polygon are already suppored in mapnik.

I'm still ambivalent about if this really needs to be changed as quoting currently works fine:

#countries['mapnik::geometry_type'=3] {
  polygon-fill: #fff;
}

@rcoup
Copy link

rcoup commented Jan 31, 2013

for Future Rob's reference, @springmeyer says the following works as-is:

#countries['mapnik::geometry_type'=polygon] {
  polygon-fill: #fff;
}
#countries['mapnik::geometry_type'=collection] {
  /* for features with mixed types */
}

@rcoup
Copy link

rcoup commented Jan 31, 2013

Personally I'd prefer the #countries polygon { ... } model (ie. geometry type as a conceptual equivalent to a CSS element selector), which we talked about in 2011, not sure if @tmcw has had any further thoughts since then?

(just because I like the concept doesn't mean it's straightforward to implement though 😉)

@tmcw
Copy link
Contributor

tmcw commented Feb 1, 2013

#countries polygon { ... }

Not sure. What about

#countries polygon point { ... }

Is this valid or no? The concept doesn't map cleanly for me - geometry types are attributes of features and should be filtered on. CSS element selectors are for atoms which are contained in other things - a div inside of body and so on.

polygon { ... }

should be

['mapnik::geometry_type'=polygon] { ... }

Just like any other anonymous filter selector.

@rcoup
Copy link

rcoup commented Feb 1, 2013

Yup, the filter approach definitely works for geometry type. Memory dredge:

#mylayer linestring {
  line-color: yellow;
  line-width: 1;

  vertex:first { 
    /* make first vertex of line red */
    marker-fill: red;
    marker-width: 1;
  }
}

#countries polygon ring vertex:first {
  /* highlight start vertex of each ring */
  marker-color: red; 
}

Need to dig up Shawn/Josh's notes.

@strk
Copy link
Contributor

strk commented Nov 6, 2013

I think this ticket can be closed, as ["mapnik::geometry_type"=something] is working fine.
Or am I missing anything ?

@springmeyer
Copy link
Author

yes quoting, or ["mapnik::geometry_type"=something] is working fine and changing this is not worth it now. closing

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants