Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add realistic Sports Field Marking for pitches #1126

Open
matthijsmelissen opened this issue Nov 11, 2014 · 43 comments
Open

Add realistic Sports Field Marking for pitches #1126

matthijsmelissen opened this issue Nov 11, 2014 · 43 comments

Comments

@matthijsmelissen
Copy link
Collaborator

The French rendering uses nice icons for sport fields:
http://tile.openstreetmap.fr/?zoom=17&lat=48.94614&lon=2.35456&layers=B0000000FFFFFFF

It would be nice to add them to the main rendering too.

@HolgerJeromin
Copy link
Contributor

related to #844

@matthijsmelissen
Copy link
Collaborator Author

@pnorman The French rendering uses the following query:

(select *, abs(a12-a23) as angle_diff, (a12+a23+90)/2 as angle 
  from 
  (select 
      *, st_npoints(way2) as nb, 
      ST_Distance(st_pointn(way2,1),st_pointn(way2,2)) as d12, 
      ST_Distance(st_pointn(way2,3),st_pointn(way2,2)) as d23,
      ST_Distance(st_pointn(way2,1),st_pointn(way2,3)) as d13,
      degrees(st_azimuth(st_pointn(way2,1),st_pointn(way2,2))) as a12,
      degrees(st_azimuth(st_pointn(way2,2),st_pointn(way2,3))) as a23 
    from 
    (select *, st_area(way) as way_area, ST_ExteriorRing(ST_SimplifyPreserveTopology(way,100)) as way2 
      from 
      (select (st_dump(way)).geom as way, sport, surface, access 
        from planet_osm_polygon 
        where sport in ('tennis','soccer','basketball','rugby','rugby_union','rugby_league','american_football')
          AND way && !bbox!) as dump) as simplified) as simplified2) as sports

Could we use this query too in osm-carto?

@pnorman
Copy link
Collaborator

pnorman commented Jan 31, 2015

I reformatted the SQL to not be a single line mess.

Where is the styling for this? I wonder if they're using mapnik 3 features.

@matthijsmelissen
Copy link
Collaborator Author

@matthijsmelissen matthijsmelissen modified the milestones: 3.x - Needs upgrade to Mapnik, Bugs and improvements Jan 31, 2015
@matthijsmelissen
Copy link
Collaborator Author

transform is a Mapnik 3.0 feature -> postponing this to 3.0 milestone.

@Rovastar
Copy link
Contributor

Does the french carto pitches really need mapnik 3? Because they have had it for ages since probably around the start of osm-carto. I first noticed it March 2013. Was mapnik 3 alpha or whatever around then and they used that?

@matthijsmelissen
Copy link
Collaborator Author

@cquest Do you know whether it would be possible to use the sport pitches icons without using Mapnik 3?

@cquest
Copy link

cquest commented Jan 31, 2015

As far as I know, we have mapnik 2.2 on our server.
My sport field postgis query looks horrible, do not hesitate to improve it !

@matthijsmelissen
Copy link
Collaborator Author

According to the documentation, point-transform is a 3.0 feature. Is the documentation wrong?

@cquest
Copy link

cquest commented Jan 31, 2015

I'm really not familiar with mapnik source code (first time I'm digging it), but 2.2.x source seems to contains point-transform support (not familiar either with C++): https://github.com/mapnik/mapnik/blob/2.2.x/src/grid/process_point_symbolizer.cpp#L72

@Rovastar
Copy link
Contributor

I think the documentation is wrong for it. I thought it was odd that your code Christian used mapnik 3. I don't think it even existed 2 years ago.

@matthijsmelissen
Copy link
Collaborator Author

I think we always believed we couldn't rotate images (spring icons for example) because Mapnik wouldn't support it. Maybe we've been wrong all along? @gravitystorm @pnorman?

@Rovastar
Copy link
Contributor

Rovastar commented Feb 1, 2015

I have never seen it mentioned here that we cannot support it, but maybe I missed it.
I know there is some other stuff in carto-fr that requires more database columns that we don't have but didn't think it effected this.

older revisions (2 Dec 2011) of the mapnik documentation imply it is possible.
https://github.com/mapnik/mapnik/wiki/PointSymbolizer/2113cbd3662f6372f745c03adaa9da9a6dcd4638
And that was before carto-css was even started, It must have been in Mapnik 2.0.
Maybe the behaviour changes in v3 hence the change in documentation.

@matthijsmelissen
Copy link
Collaborator Author

I have never seen it mentioned here that we cannot support it, but maybe I missed it.

@pnorman wrote here:

I would say the following are blocked by not having a Mapnik 3 release [...]
Rotating symbols

@pnorman
Copy link
Collaborator

pnorman commented Feb 1, 2015

Rotating symbols based on expressions requires expressions anywhere, which was added with the expr-v2 branch (mapnik/mapnik#2224 for a starting point).

When we speaking of Mapnik 3 features, we mean features that are not in any released versions of Mapnik but are expected to be in Mapnik 3.0 when it is released. These are found in the master branch of the Mapnik git, as well as sometimes in development branches.

The last released version of Mapnik, 2.2.0, was released in June 2013. This is about the same time as the stylesheet was created. Most features merged since then are Mapnik 3 features, although some are in the Mapnik 2.3.x development branch.

Some code written before June 2013 is not in Mapnik 2.2.0, but this is fairly minor.

@Rovastar
Copy link
Contributor

Rovastar commented Feb 1, 2015

ummh not sure if I understand.
are you saying we can do sport pitches like in carto fr or not?

@matthijsmelissen
Copy link
Collaborator Author

Rotating symbols based on expressions requires expressions anywhere

Is point-transform: "rotate([angle]) scale(0.075)"; an expression? Because this seems to work in Mapnik 2.2.

@dkniffin
Copy link
Contributor

dkniffin commented Jun 5, 2015

One thing to note for this issue is some fields support multiple sports. Those can be tagged with either sport=multi or sport=sport1;sport2

@HolgerJeromin
Copy link
Contributor

This issue should be renamed, so it is clear no icons but markings are meant.
"Add realistic Sports Field Marking for pitches"

@matthijsmelissen matthijsmelissen changed the title Add icons for sport fields Add realistic Sports Field Marking for pitches Jun 25, 2015
@matthijsmelissen
Copy link
Collaborator Author

Done

@Wuzzy2
Copy link

Wuzzy2 commented Jun 25, 2015

Actually, I do not like this proposal.
I would personally prefer icons over markings.
The idea: For sports pitches, draw a sport icon in the center of the pitch.
For example, a soccer ball for a soccer field, a basketball for a basketball field, etc.

This would also work for multiple sports, just use another icon for this case.

This is very simple, but I think it would go easier on the eyes and be much more easy to recognize.

While those markings may look nice and pretty on the map, the map should stay abstract IMO; I also doubt those markings always accurately represent the actual lines. The user will be misled into believing that those lines are an accurate representation, rather than just automatically-generated markings.
Needless to say, those markings would fail when a pitch has multiple sports.
I also find those markings may make it harder to recognize the sports type of a pitch, because it is simply not abstract enough.

@kocio-pl
Copy link
Collaborator

On the other hand they would be easily visible and no more symbolic than the icons. When multiple sports are on the same pitch, the icon may be hard to draft (you can check how serious is this problem with shop=sports - I've made many sketches, yet none is clear enough to beat others).

I like the idea of French pitches, however I see the problem with consistency: some sports have easily recognizable line shapes, but probably not all of them. I'm not sure we should care for it, but better to know the downsides (thanks, @Wuzzy2!).

@HolgerJeromin
Copy link
Contributor

Just to note the problem here:
http://mc.bbbike.org/mc/?lon=-38.522442&lat=-3.808046&zoom=18&num=2&mt0=mapnik-german&mt1=osmfr
The code from osmfr works in central europe, but not in brasil. The german fix (deployed at the fifa world cup) is hidden here:
http://svn.openstreetmap.org/applications/rendering/mapnik-german/inc-de/layer-landcover.xml.inc

osmfr bugreport is http://trac.openstreetmap.fr/ticket/589

@pnorman
Copy link
Collaborator

pnorman commented Jun 26, 2015

I'm leaning to preferring icons.

I should note that the problem with osmfr is easily solvable by taking the length of a geography, not geometry.

@dieterdreist
Copy link

2015-06-26 10:27 GMT+02:00 Paul Norman [email protected]:

I'm leaning to preferring icons.

I'm leaning towards field markings (subtle, less prominent than in the FR
style, I'd use the same colour than the pitch just slightly brighter). We
already have a lot of icons, and they really aren't needed for sport fields
(keep in mind this is a general purpose map). On the other hand there are
some objects that work better with an icon, e.g. covered swimming pools. In
the end we should have a look at all sports values and decide case by case
which representation fits best. For soccer, basketball and tennis at least,
I'd prefer lines instead of icons (maybe use an additional icon in zoom 19
maybe 18)

@dkniffin
Copy link
Contributor

I like both options, and I'm not sure which is better. Maybe we do icons at lower zooms, then when we get close enough, it turns to markings? I'm not sure what zoom would be "close enough"

@Rovastar
Copy link
Contributor

Got to be markings over icons where available for me. if the area is mapped correctly the lines get represented really well.
I thought one if the ideas was to change the colour of the pitches to be less deep green and have them similar/same as the grass.

@imagico
Copy link
Collaborator

imagico commented Jun 26, 2015

Quite frequently people explicitly map pitch markings with barrier=line which indicates mappers want to have these shown.

As @HolgerJeromin mentioned the French style rendering of these only works correctly in a limited range of map scale, i.e. latitude. The German style has a more generic but also more complex variant:

https://github.com/woodpeck/openstreetmap-carto-german/blob/master/project.yaml#L461
https://github.com/woodpeck/openstreetmap-carto-german/blob/master/sport.mss

None of these is ideal IMO, much better would be if PostGIS/mapnik would make available the scale factor for use.

@matthijsmelissen
Copy link
Collaborator Author

This should perhaps also be solved in Mapnik?

See also #1853 and the reason for closing that issue.

@kocio-pl
Copy link
Collaborator

kocio-pl commented Sep 6, 2016

As the Mapnik upgrade time is very close, we can get back to a discussion. I still prefer having it and not the icon, what about others?

Is anybody willing to create a suitable PR, BTW?

@BalooUriza
Copy link

On Tue, Sep 6, 2016 at 10:00 AM, kocio-pl [email protected] wrote:

As the Mapnik upgrade time is very close
https://lists.openstreetmap.org/pipermail/talk/2016-September/076770.html,
we can get back to a discussion. I still prefer having it and not the icon,
what about others?

This gets tricky for pitches of irregular shapes like baseball, cricket,
multisport, or areas where multiple fields share the same polygon.

@kocio-pl
Copy link
Collaborator

We could do it just for some well-known cases, not all the pitches (just like it is in French style probably).

@imagico
Copy link
Collaborator

imagico commented Feb 1, 2017

Updated link to the implementation in the German style:

https://github.com/giggls/openstreetmap-carto-de/blob/master/project.mml#L617
https://github.com/giggls/openstreetmap-carto-de/blob/master/sport.mss

This still severely lacks documentation of course - especially with regard to the various magic constants in the mss.

In principle i would be in favor of this approach since it is a much more elegant way to indicate the type of sport than icons but given the significant complexity of the method used it would be fairly strange to accept this but reject #1853 on grounds of code complexity.

@polarbearing
Copy link
Contributor

Rendering pitch lines, in particular in cases where they do not exist in reality, suggests a quality of a pitch that is not true.
Imagine, e.g. for soccer, training pitches which are used in different ways, sometimes the full field, sometimes split in halves for younger players, or completely unmarked sparetime pitches in a residential area that has just an iron frame to mark the goal, and half of the grass rubbed down.

@dieterdreist
Copy link

dieterdreist commented Jul 26, 2018 via email

@kocio-pl
Copy link
Collaborator

I like this idea.

@jeisenbe
Copy link
Collaborator

Right now there have been comments about the number of icons becoming too high, and a PR to add sports icons was just closed: #3651.

This issue suggests a way of rendering pitches in a more subtle way that will still show what sport is played at high zoom levels.

Should we consider moving forward with this rendering in a way similar to the German style, or should it really be limited to pitches that have markings?

I think of this as a way to show the use of the pitch, not a way to render the way it looks from an aerial image, therefore it should not matter if a soccer pitch is just a dirt field (Similarly, all pitches are blue-green, even if their surface is concrete or clay, because it's an abstraction).

@polarbearing
Copy link
Contributor

Rendering fictive pitch markings is kind of a big icon. However it is worse than our usual 14px icons, as it indicates lines that might not be there in reality. That contradicts with markings that are mapped according to their existence, e.g. parking_space.

@jidanni
Copy link

jidanni commented Apr 6, 2020

Compromise: those high tech French patterns plus icons (for we
non-sport people who don't know which pattern is which sport,
and are in a panic: "James told me to meet him at the basketball court,
but which one is it?") But wait, "Ground truth" says those lines might
not be there... but OK, think of it as an icon...

(But wait again, nobody has figured out how to label the Pacific Ocean yet,
and we are arguing about a few lines on a playing field ☹)

@polarbearing
Copy link
Contributor

Cross-referencing a completely unrelated topic is counter-productive.

@Adamant36
Copy link
Contributor

Adamant36 commented Apr 10, 2020

Should we consider moving forward with this rendering in a way similar to the German style, or should it really be limited to pitches that have markings?

I thought there was technological limitations keeping us from doing things similar to the German style and that they where doing a workaround that wouldn't work in this style for some reason (or was that rendering golf=* stuff?). Maybe it was just that it wasn't consistent enough.

@jeisenbe
Copy link
Collaborator

That was golf=*, there is no problem with field markings, except that only a small number are tagged as to whether or not their are actual markngs.

(Now golf= features are imported as polygons, since the database reload and schema changes in v5.0.0, so there is no problem with rendering golf=* features, from a technical standpoint)

@Adamant36
Copy link
Contributor

there is no problem with field markings

I could have sworn there was another issue with sample pictures from the German style where they didn't align well with the pitch sometimes.

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

No branches or pull requests