Abstract the definition of openstreetmap resources

in #utopian-io7 years ago (edited)

Components

The components affect are all aspects of the system that deal with the map domain, the parsing, rendering and editing of map components.

The java code that deals with openstreetmap and allows to edit has hard coded constants that limit how the app can be used.

Proposal

The proposal is to strip out all the code that contains hard coded resources like "restaurant" and attributes like "Internet" and put them into a datafile the defines what the resources are , what attributes they support and how to render them. The app will then read that definition file in an be able to be extended for more types of data easily. The duplication of code will be reduced.

Code Review

The java code has a lot of copy and past of string tags that could be consolidated like this.

The list of tags to support does not need to be in the java code and can be read from a property file in this location https://github.com/CityZenApp/Android-Development/blob/master/CityZenApp/app/src/main/java/com/cityzen/cityzen/ApplicationConstants.java

There are switches based on the tags that would be better represented as property files like this one https://github.com/CityZenApp/Android-Development/blob/master/CityZenApp/app/src/main/java/com/cityzen/cityzen/Adapters/ParcelablePoiListAdapter.java

this code is duplicated here leading to higher maintenance costs:
https://github.com/CityZenApp/Android-Development/blob/master/CityZenApp/app/src/main/java/com/cityzen/cityzen/Adapters/PlaceListAdapter.java

This lookup can have internet could also be put into a resource file, or some other description of the types of data outside of the code.
https://github.com/CityZenApp/Android-Development/blob/master/CityZenApp/app/src/main/java/com/cityzen/cityzen/Fragments/EditPoiFragment.java

It is also duplicated here:
https://github.com/CityZenApp/Android-Development/blob/master/CityZenApp/app/src/main/java/com/cityzen/cityzen/Fragments/CreatePoiFragment.java#L464

Mockups / Examples

See the website here http://visualtags.hotosm.org/collection/3 with the xml file give

  <group name="Food+Drinks" icon="presets/restaurant.png">
        <item name="Restaurant" icon="presets/restaurant.png" type="node,relation">
          <link href="http://wiki.openstreetmap.org/wiki/Tag:amenity=restaurant"/>
          <label text="Edit Restaurant"/>
          <key key="amenity" value="restaurant"/>
          <text key="name" text="Name"/>
          <space/>
          <text key="operator" text="Operator"/>
          <multiselect key="cuisine" text="Cuisine" values="italian;chinese;pizza;burger;greek;german;indian;regional;kebab;turkish;asian;thai;mexican;japanese;french;sandwich;sushi"/>
          <check key="microbrewery" text="Microbrewery" default="off"/>
          <text key="opening_hours" text="Opening Hours"/>
          <combo key="stars" text="Stars" values="1,2,3,4,5,6,7"/>
          <space/>
          <combo key="internet_access" text="Internet access" values="yes,wlan,wired,terminal,no"/>
          <space/>

Something like the yaml file here could be used to describe the tags and attributes of them
https://github.com/sozialhelden/wheelmap-open-source/blob/master/spec/fixtures/node_types.yml
or this yaml
https://github.com/openmaptiles/openmaptiles/blob/master/layers/poi/mapping.yaml

This file is for presets of an editor
https://github.com/dittaeva/vespucci/blob/master/assets/preset.xml

Here is a more formal definition of the pois
https://github.com/iocast/poiservice/blob/master/resources/osm_skos4.xml

This is another list of tags and values
https://github.com/jsydow/tracebook/blob/master/TraceBook/res/raw/tags_en.xml

Here is a chart I worked on in the past
https://github.com/h4ck3rm1k3/FOSM-Api/blob/master/OSM-API-Proxy/rdf/OSM_Open_Map_Features_Spreadsheet-Wiki%20OSM%20Features%20Chart-1.csv

Benefits

The benefits are that you can abstractly define new POIs or reuse existing datasets and make your program more flexible and usable.



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Hey @h4ck3rm1k3st33m I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Suggestions

  • Contribute more often to get higher and higher rewards. I wish to see you often!
  • Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck!

Get Noticed!

  • Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x