Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,7 @@ object AchievementsModule {
"AddVegetarian",
"AddVegan",
"AddKosher",
"AddPoliceType",
// tourist related
"AddInformationToTourism",
"AddBoardType",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ import de.westnordost.streetcomplete.quests.playground_access.AddPlaygroundAcces
import de.westnordost.streetcomplete.quests.postbox_collection_times.AddPostboxCollectionTimes
import de.westnordost.streetcomplete.quests.postbox_ref.AddPostboxRef
import de.westnordost.streetcomplete.quests.postbox_royal_cypher.AddPostboxRoyalCypher
import de.westnordost.streetcomplete.quests.police_type.AddPoliceType
import de.westnordost.streetcomplete.quests.powerpoles_material.AddPowerPolesMaterial
import de.westnordost.streetcomplete.quests.railway_crossing.AddRailwayCrossingBarrier
import de.westnordost.streetcomplete.quests.summit_register.AddSummitRegister
Expand Down Expand Up @@ -231,6 +232,7 @@ import javax.inject.Singleton
AddPostboxRef(),
AddWheelchairAccessToiletsPart(),
AddBoardType(),
AddPoliceType(),
AddPowerPolesMaterial(),
AddCarWashType(),
AddBenchStatusOnBusStop(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package de.westnordost.streetcomplete.quests.police_type

import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.data.osm.osmquest.OsmFilterQuestType
import de.westnordost.streetcomplete.data.osm.changes.StringMapChangesBuilder
import de.westnordost.streetcomplete.data.quest.NoCountriesExcept

class AddPoliceType : OsmFilterQuestType<PoliceType>() {

override val elementFilter = """
nodes, ways with
amenity = police
and !operator
"""
override val commitMessage = "Add police type"
override val wikiLink = "Tag:amenity=police"
override val icon = R.drawable.ic_quest_police
override val enabledInCountries = NoCountriesExcept(
"IT"
)

override fun getTitle(tags: Map<String, String>) = R.string.quest_policeType_title

override fun createForm() = AddPoliceTypeForm()

override fun applyAnswerTo(answer: PoliceType, changes: StringMapChangesBuilder) {
changes.add("name", answer.policeName);
Copy link
Member

@matkoniecz matkoniecz Mar 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure about adding names? I am unfamiliar with Italy tagging, but in Poland police stations are often with own names such as name=Komisariat IV. See https://www.openstreetmap.org/way/201286959 https://www.openstreetmap.org/way/374532370 https://www.openstreetmap.org/way/167008548 that may be similar cases in Italy.

And additionally note that quest filter is not excluding things with name tag or operator:wikidata or operator:wikipedia

See say https://www.openstreetmap.org/way/24240779 - what will happen if user will solve quest in place where either of this tags is present already?

Copy link
Contributor Author

@naposm naposm Mar 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure about adding names? I am unfamiliar with Italy tagging, but in Poland police stations are often with own names such as name=Komisariat IV. See https://www.openstreetmap.org/way/201286959 https://www.openstreetmap.org/way/374532370 https://www.openstreetmap.org/way/167008548 that may be similar cases in Italy.

I added the names only to avoid confusion between Polizia Stradale (road patrols), Polizia Ferroviaria (for trains) and Polizia di Stato (the main branch) which all have operator=Polizia di Stato. I agree, indeed I'd have never added them as me myself wouldn't add names with amenity=police. I've just asked on the Italian ML for this to see how other mappers add these. Anyway I think that the name tag doesn't get overridden with add() does it?

And additionally note that quest filter is not excluding things with name tag or operator:wikidata or operator:wikipedia

Yes, that was one thing I was thinking about, I didn't filter it because I want to add operator anyway (which I think is more important), the only reason there are these two tags is if it is a very important police station operated exclusively by a separated entity only for that station.
So I wouldn't like to override the tags but I'd still like to add the operator one, how do you think we can solve that? 🤔
I'd also love to make a query on Overpass to see how many cases are there and if it's worth the effort...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You asked on the Italian mailing list, so I'd say you should proceed whatever was the conclusion of that.
Note that it is also possible to only add the name if it does not exist yet:
if (changes.getPreviousValue(...) == null) changes.add(...)

changes.add("operator", answer.operator.operatorName);
changes.add("operator:wikidata", answer.operator.wikidata);
changes.add("operator:wikipedia", answer.operator.wikipedia);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package de.westnordost.streetcomplete.quests.police_type

import android.os.Bundle
import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.quests.AImageListQuestAnswerFragment
import de.westnordost.streetcomplete.view.image_select.Item

class AddPoliceTypeForm : AImageListQuestAnswerFragment<PoliceType, PoliceType>() {

override val items = listOf(
Item(PoliceType.CARABINIERI, R.drawable.ic_police_type_carabinieri, R.string.quest_policeType_type_it_carabinieri),
Item(PoliceType.POLIZIA_DI_STATO, R.drawable.ic_police_type_polizia, R.string.quest_policeType_type_it_polizia_di_stato),
Item(PoliceType.POLIZIA_MUNICIPALE, R.drawable.ic_police_type_municipale, R.string.quest_policeType_type_it_polizia_municipale),
Item(PoliceType.POLIZIA_LOCALE, R.drawable.ic_police_type_locale, R.string.quest_policeType_type_it_polizia_locale),
Item(PoliceType.GUARDIA_DI_FINANZA, R.drawable.ic_police_type_finanza, R.string.quest_policeType_type_it_guardia_di_finanza),
Item(PoliceType.POLIZIA_STRADALE, R.drawable.ic_police_type_stradale, R.string.quest_policeType_type_it_polizia_stradale),
Item(PoliceType.GUARDIA_COSTIERA, R.drawable.ic_police_type_costiera, R.string.quest_policeType_type_it_guardia_costiera),
Item(PoliceType.POLIZIA_FERROVIARIA, R.drawable.ic_police_type_ferroviaria, R.string.quest_policeType_type_it_polizia_ferroviaria)
)

override val itemsPerRow = 3

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
imageSelector.cellLayoutId = R.layout.cell_icon_select_with_label_below
}

override fun onClickOk(selectedItems: List<PoliceType>) {
applyAnswer(selectedItems.single())
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package de.westnordost.streetcomplete.quests.police_type

enum class PoliceType(val policeName: String, val operator: PoliceOperator) {
CARABINIERI("Arma dei Carabinieri", PoliceOperator.ARMA_DEI_CARABINIERI),
GUARDIA_COSTIERA("Guardia Costiera", PoliceOperator.GUARDIA_COSTIERA),
GUARDIA_DI_FINANZA("Guardia di Finanza", PoliceOperator.GUARDIA_DI_FINANZA),
POLIZIA_DI_STATO("Polizia di Stato", PoliceOperator.POLIZIA_DI_STATO),
POLIZIA_MUNICIPALE("Polizia Municipale", PoliceOperator.POLIZIA_MUNICIPALE),
POLIZIA_LOCALE("Polizia Locale", PoliceOperator.POLIZIA_LOCALE),
POLIZIA_STRADALE("Polizia Stradale", PoliceOperator.POLIZIA_DI_STATO),
POLIZIA_FERROVIARIA("Polizia Ferroviaria", PoliceOperator.POLIZIA_DI_STATO)
}

enum class PoliceOperator(val operatorName: String, val wikidata: String, val wikipedia: String) {
ARMA_DEI_CARABINIERI("Arma dei Carabinieri", "Q54852", "en:Carabinieri"),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello. Is English Wikipedia linked for a specific reason? It has differences with respect to the Italian article, but I did not read through them, and cannot say which article is more comprehensive or "better".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reviewing!
I don't know why, but the ID presets (https://nsi.guide) uses the English Wikipedia, I'd love to change it to the Italian one as it is the one I use for the other operators, but I used the one I think is used more (since lots of people map with ID). Should I use the Italian Wikipedia? From a first impression I find the Italian one more complete. 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Poland norm is to use Polish Wikipedia if possible.

Note that iD presets are not something free from mistakes - if Italian community prefers Italian links I can change it (I have commit rights to NSI repo, so I can edit directly and I will be able to find it).

And Italian police will be present in Italy, so it is not necessary to consult more widely.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it would be much appreciated, thank you. It seems a cleanup commit from Dec 2020 replaced it:Arma dei Carabinieri with en:Carabinieri.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By all means, use the Italian one. For some reason I changed it when I was doing osmlab/name-suggestion-index#4752, and the Italian one is most certainly better. (Maybe when I was looking up Wikidata? I don't remember.) Sorry about that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that only https://github.com/osmlab/name-suggestion-index/blob/main/data/operators/amenity/police.json#L21 needs change to it:

Is there any other change required? Such as adding Wikipedia linking where it is missing in NSI?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@matkoniecz The Italian page name is slightly different. Need to change to it:Arma dei Carabinieri to get to here. I thought (perhaps mistaken) that it didn't matter what Wikipedia language you use in the tag. Whatever consumer of the data could use the sister pages to show you the one in your language, if available. (That doesn't mean that consumers of the data do do that.)

Please feel free to add missing tags to NSI.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure I will after this one will be merged, @dieterdreist suggested me in the list to remove the Wikipedia link and just use Wikidata, so I'll do a PR with all those changes, I'll also remove Corpo Forestale dello Stato which doesn't exist anymore.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, so: delete wikipedia link, keep wikidata link.

POLIZIA_DI_STATO("Polizia di Stato", "Q897817", "it:Polizia di Stato"),
GUARDIA_DI_FINANZA("Guardia di Finanza", "Q1552861", "it:Guardia di Finanza"),
POLIZIA_MUNICIPALE("Polizia Municipale", "Q1431981", "it:Polizia municipale"),
POLIZIA_LOCALE("Polizia Locale", "Q61634147", "it:Polizia locale (Italia)"),
GUARDIA_COSTIERA("Guardia Costiera", "Q1552839", "it:Corpo delle capitanerie di porto - Guardia costiera")
}
28 changes: 28 additions & 0 deletions app/src/main/res/drawable/ic_police_type_carabinieri.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="128dp"
android:height="128dp"
android:viewportWidth="128"
android:viewportHeight="128">
<path
android:pathData="M13.195,1.149L115.089,1.149A12.009,12.009 0,0 1,127.098 13.158L127.098,115.052A12.009,12.009 0,0 1,115.089 127.061L13.195,127.061A12.009,12.009 0,0 1,1.185 115.052L1.185,13.158A12.009,12.009 0,0 1,13.195 1.149z"
android:strokeWidth="1.93905"
android:fillColor="#ffffff"
android:strokeColor="#000000"/>
<path
android:pathData="m59.21,107.27c-3.341,-0.962 -6.734,-2.93 -9.416,-5.462 -3.938,-3.718 -6.416,-8.684 -6.893,-13.812l-0.239,-2.573l22.591,0 22.591,0l-0.005,1.57c-0.024,6.85 -5.206,14.919 -11.779,18.339 -1.587,0.826 -3.86,1.755 -5.05,2.065 -2.929,0.763 -8.932,0.698 -11.799,-0.127zM15.797,82.169c0,-1.652 0.678,-2.143 4.862,-3.528 9.465,-3.132 16.478,-8.106 23.049,-16.347 1.475,-1.849 3.404,-3.946 4.288,-4.658 1.719,-1.386 4.779,-3.248 5.334,-3.247 0.185,0 0.818,0.921 1.406,2.046 0.637,1.22 2.088,2.989 3.594,4.383 2.467,2.284 2.509,2.353 1.808,2.987 -1.145,1.036 -1.974,3.651 -1.761,5.549 0.707,6.272 9.244,8.359 12.719,3.109 1.821,-2.752 1.545,-6.26 -0.686,-8.704l-0.721,-0.79 1.655,-1.188c1.707,-1.226 4.258,-4.368 5.111,-6.295 0.267,-0.603 0.653,-1.095 0.857,-1.093 0.702,0.007 4.068,2.132 5.802,3.664 0.954,0.843 2.802,2.898 4.106,4.567 6.016,7.698 13.436,12.93 22.729,16.026 2.169,0.722 4.151,1.482 4.405,1.688 0.254,0.206 0.462,0.936 0.462,1.622l0,1.248l-49.509,0 -49.509,0zM63.162,72.613c-1.516,-0.747 -2.29,-2.19 -2.29,-4.269 0,-2.669 1.838,-4.349 4.756,-4.349 4.606,0 5.932,6.654 1.724,8.651 -1.556,0.738 -2.644,0.73 -4.191,-0.032zM62.431,59.347C61.379,58.823 60.038,57.784 59.451,57.038 57.09,54.04 55.133,48.798 54.721,44.369l-0.236,-2.543l10.768,0 10.768,0l-0.003,1.57c-0.004,2.326 -1.331,7.443 -2.644,10.194 -1.42,2.976 -4.012,5.644 -6.079,6.258 -2.139,0.635 -2.7,0.578 -4.864,-0.501zM54.591,37.61c0,-0.693 0.235,-2.481 0.522,-3.972 1.821,-9.465 6.94,-14.985 12.266,-13.227 1.95,0.644 4.635,3.477 5.995,6.327 1.353,2.835 2.64,7.887 2.644,10.378l0.003,1.755L65.306,38.87 54.591,38.87Z"
android:fillColor="#000000"/>
<path
android:pathData="m54.732,37.264c0.076,-1.732 0.377,-3.571 0.938,-5.728 2.048,-7.872 6.602,-12.389 11.263,-11.173 1.111,0.29 1.955,0.849 3.305,2.19 1.964,1.951 3.114,3.867 4.113,6.855 1.003,3.001 1.6,6.043 1.6,8.157l0,1.214L65.308,38.778 54.666,38.778Z"
android:strokeLineJoin="miter"
android:strokeWidth="0.424264"
android:fillColor="#ff0000"
android:strokeColor="#ffffff"
android:strokeLineCap="butt"/>
<path
android:pathData="M63.263,59.652C60.121,58.235 58.43,56.227 56.654,51.803 55.501,48.931 54.916,46.336 54.637,42.863l-0.08,-1l10.713,0 10.713,0l-0.065,1.628c-0.075,1.88 -0.375,3.443 -1.179,6.141 -0.876,2.94 -1.577,4.495 -2.794,6.203 -0.889,1.247 -2.607,2.906 -3.56,3.437 -0.944,0.526 -2.225,0.872 -3.229,0.871 -0.699,-0 -0.942,-0.063 -1.892,-0.492z"
android:strokeLineJoin="miter"
android:strokeWidth="0.424264"
android:fillColor="#0000ff"
android:strokeColor="#ffffff"
android:strokeLineCap="butt"/>
</vector>
26 changes: 26 additions & 0 deletions app/src/main/res/drawable/ic_police_type_costiera.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="128dp"
android:height="128dp"
android:viewportWidth="128"
android:viewportHeight="128">
<path
android:pathData="M13.138,1.014L114.986,1.014A12.004,12.004 0,0 1,126.99 13.018L126.99,114.865A12.004,12.004 0,0 1,114.986 126.869L13.138,126.869A12.004,12.004 0,0 1,1.134 114.865L1.134,13.018A12.004,12.004 0,0 1,13.138 1.014z"
android:strokeWidth="1.93817"
android:fillColor="#ffffff"
android:strokeColor="#000000"/>
<path
android:pathData="M13.794,102.591l-9.617,0l38.47,-76.939l9.617,0z"
android:fillColor="#009246"/>
<path
android:pathData="M21.488,102.591l-9.617,0l38.47,-76.939l9.617,0z"
android:fillColor="#ffffff"/>
<path
android:pathData="M84.963,102.591l-65.398,0l38.47,-76.939l65.398,0z"
android:fillColor="#ce2b37"/>
<path
android:pathData="M71.499,64.122m-23.082,0a23.082,23.082 0,1 1,46.164 0a23.082,23.082 0,1 1,-46.164 0"
android:fillColor="#ffffff"/>
<path
android:fillColor="#FF000000"
android:pathData="m71.499,45.541c-1.577,0 -2.885,1.269 -2.885,2.847 0,1.308 0.885,2.424 2.077,2.731l0,1.962l-5.77,0c-0.308,-0.423 -0.885,-0.692 -1.5,-0.692 -1,0 -1.77,0.654 -1.77,1.5 0,0.808 0.808,1.5 1.77,1.5 0.654,0 1.231,-0.308 1.539,-0.731l5.77,0l0,21.62c0,1.077 -0.692,1.847 -1.577,1.847 -2.424,0 -5.001,-1.077 -7.001,-2.693 -2.154,-1.693 -3.655,-3.924 -3.655,-6.001 0,-1.039 1.116,-1.385 1.847,-1.577 -1.808,-0.462 -4.347,-1.193 -5.963,-2.539 0.423,2.154 -0.038,4.462 -0.577,6.617 0.5,-0.539 0.962,-1.269 2,-1.269 1.039,0 2.462,3.808 5.578,6.155 3.231,2.462 7.001,2.616 8.694,3.808 0.616,0.423 1.462,2.039 1.462,2.039 0,0 0.846,-1.616 1.462,-2.039 1.654,-1.193 5.424,-1.346 8.694,-3.808 3.078,-2.347 4.539,-6.155 5.578,-6.155 1.039,0 1.5,0.769 2,1.269 -0.539,-2.154 -0.962,-4.462 -0.577,-6.617 -1.616,1.346 -4.116,2.077 -5.963,2.539 0.731,0.192 1.847,0.539 1.847,1.577 0,2.077 -1.5,4.309 -3.655,6.001 -2,1.577 -4.616,2.693 -7.001,2.693 -0.885,0 -1.577,-0.769 -1.577,-1.847L72.345,54.697l5.732,0c0.308,0.462 0.885,0.731 1.539,0.731 1,0 1.77,-0.654 1.77,-1.5 0,-0.808 -0.808,-1.5 -1.77,-1.5 -0.616,0 -1.193,0.269 -1.5,0.692l-5.77,0l0,-1.962c1.193,-0.346 2.077,-1.423 2.077,-2.731 -0.077,-1.577 -1.346,-2.885 -2.924,-2.885zM71.499,47.003c0.769,0 1.385,0.616 1.385,1.423 0,0.769 -0.616,1.385 -1.423,1.385 -0.769,0 -1.423,-0.616 -1.423,-1.385 0.038,-0.769 0.692,-1.423 1.462,-1.423z"/>
</vector>
51 changes: 51 additions & 0 deletions app/src/main/res/drawable/ic_police_type_ferroviaria.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="128dp"
android:height="128dp"
android:viewportWidth="128"
android:viewportHeight="128">
<path
android:pathData="M13.138,1.014L114.986,1.014A12.004,12.004 0,0 1,126.99 13.018L126.99,114.865A12.004,12.004 0,0 1,114.986 126.869L13.138,126.869A12.004,12.004 0,0 1,1.134 114.865L1.134,13.018A12.004,12.004 0,0 1,13.138 1.014z"
android:strokeWidth="1.93817"
android:fillColor="#ffffff"
android:strokeColor="#000000"/>
<path
android:pathData="M71.201,56.866 L47.416,79.039 22.018,70.573c-3.218,1.841 -7.044,3.277 -4.031,9.272l33.057,12.9 15.722,-11.691 0.403,16.932 34.382,-41.236z"
android:strokeLineJoin="round"
android:strokeWidth="4.48485"
android:fillColor="#871a09"
android:strokeColor="#811401"
android:fillType="evenOdd"
android:strokeLineCap="butt"/>
<path
android:pathData="m110.306,57.673 l0,57.246 -43.136,-0.001c-2.688,-2.15 -2.688,-6.065 0,-8.753l38.701,-0.116c2.778,-1.747 0.722,-3.494 0,-5.241l-32.251,0z"
android:strokeLineJoin="round"
android:strokeWidth="4.48485"
android:fillColor="#871a09"
android:strokeColor="#811401"
android:fillType="evenOdd"
android:strokeLineCap="butt"/>
<path
android:pathData="m72.612,39.733c1.008,-0.202 29.228,-3.628 29.228,-3.628 0.165,8.629 -1.803,15.764 -12.296,16.932 -7.656,-0.611 -14.583,-2.608 -16.932,-13.304z"
android:strokeLineJoin="round"
android:strokeWidth="4.48485"
android:fillColor="#871a09"
android:strokeColor="#811401"
android:fillType="evenOdd"
android:strokeLineCap="butt"/>
<path
android:pathData="m60.115,36.105 l40.755,-5.129c0.363,0.678 -29.767,-4.962 -29.86,-5.074 0.124,0.413 -9.562,9.505 -10.895,10.203z"
android:strokeLineJoin="round"
android:strokeWidth="4.48485"
android:fillColor="#871a09"
android:strokeColor="#811401"
android:fillType="evenOdd"
android:strokeLineCap="butt"/>
<path
android:pathData="m64.574,12.361c-0.137,0.002 38.716,10.067 38.471,10.28 0.258,0.014 -2.001,5.507 -2.17,5.422 0.193,-0.12 -27.246,-6.946 -27.054,-6.672 -5.171,-4.827 -4.021,-3.089 -9.248,-9.03z"
android:strokeLineJoin="round"
android:strokeWidth="4.48485"
android:fillColor="#871a09"
android:strokeColor="#811401"
android:fillType="evenOdd"
android:strokeLineCap="butt"/>
</vector>
Loading