OpenStreetMap

Dynamic manipulation of styles based on object values in libosmscout

Posted by Framstag on 9 December 2017 in English (English)

As just stated on the Fossgis Hackingweekend at the Linuxhotel in Essen... "I'm mapping the year of constrcution for a (huge) number of houses. I'm looking for a way to visualize this on the map".

Likely multiple solutions exist, but how to do this with libosmscout?

At the start of the weekend this was not yet possible. Small discussion with another developer (not at the weekend) showed, that a general approach was needed, as colouring of ways based on attributes has also interesting use cases (hint: colour of metro lines).

Libosmscout implements tag and value combinations as features. All possible features of an object type (configurable during import) are flag in a bit set, if an concrete object has the feature.

The value of an feature is implemented as simple class that must offer serialization and deserialization methods.

So first we write a new Feature implementation that parses the start_date and year_of_construction tags. The new Feature will have two int attribute for the start and end year. Investigation of the actual tag values show and creation time can be an time interval, for our needs the year however is enough. Depending on the use case other implementation could be possible, too.

We need to do some string parsing to get most of the possible variants of the tag values parsed. Mapper: Please do not be to creative ;-)

Afterwards we add the possibility to register style processors into the rendering pipeline. The processor has a simple interface. It gets the list of feature values and the style as defined by the style sheet. It returns either the original style or a (cache) new style instance. Processors are registered by type.

Next step is to implement a simple processor for the type building. The processor checks if the construction year feature is available and the year between 1800 and 2020. In this case it return a red fill style, with the actual brightness depending on the age. Older buildings get darker red.

See the result:

Different coloring of houses based on construction year

Since there are not that much buildings with construction year mapped, let us try something more visible. Different colors depending on the house number been odd even (or not numerical).

Now that looks more obvious :-)

Different coloring of houses based on house number being odd or even

Fine. That was fun. Now back to code to refactor it for a slightly better API...

Location: Horst, Stadtbezirk VII, Essen, Regierungsbezirk Düsseldorf, North Rhine-Westphalia, Germany

Comment from John2207 on 14 December 2017 at 06:39

This diary is so much useful for me, Really. I experienced a lot of things in here about Dynamic manipulation. Thanks Framstag.

I'm an executive with QuickBooks Services. If you are a QuickBooks user and facing any kind of query related to QuickBook Point of Sale, Then you can contact our QuickBooks Point of Sale Support Community.

Comment from John2207 on 14 December 2017 at 06:41

This diary is so much useful for me, Really. I experienced a lot of things in here about Dynamic manipulation. Thanks Framstag.

I'm an executive with QuickBooks Services. If you are a QuickBooks user and facing any kind of query related to QuickBook Point of Sale, Then you can contact our QuickBooks Point of Sale Support Community by visit at: https://www.wizxpert.com/quickbooks-point-of-sale-support-phone-number/

Comment from lucystewartus on 29 March 2018 at 16:08

Thanks for sharing this, If you are looking Apple technical support contact Apple customer service number 1-844-525-0999 or more details visit: http://www.apple-customerservicenumber.com/

Comment from jpfernand on 4 May 2018 at 20:26

I like your blog you discussed good thinks about your blog your strategy is awesome I am happy to see your blog if you have any problem regards QuickBooks accounting we are here to help you.visit my blog: +18772499444 Or more detail visit: https://supportbits.com/intuit-quickbooks-support-phone-number/

Comment from johnnytechshaw on 27 July 2018 at 07:08

QuickBooks failure is usually a type of slip-up which uniquely affects the QuickBooks workers encountered purposes. It can be truly a type of business which appears to become very. Central read more server hit: declared here, the database manager can be set up on the central server, receiving QuickBooks File Doctor the company ought to be set in on only visiting every and each business.

Comment from johnnytechshaw on 27 July 2018 at 07:10

The gurus under the roof are skillful and expert. To be ready to get pro’s shows you fundamentally should communicate the multiple support number at QuickBooks File Doctor Qb is performing more info amazingly flexible to most compressed companies. All knowledge and skills may very well be the system built for the group needs. Recommendations are normally regularly transported to other statements. Visit Here:https://www.247quickbookshelp.com/quickbooks-file-doctor-fix-damaged-company-file

Comment from QuickBooksFAQ on 27 July 2018 at 08:42

To benefit from Each one of these administrations which were synchronized with the QuickBooks account in a very error freeway. Simply call QuickBooks Online Login for just about any assist. Then, I frequented the website of Contact for help Thank God, at least This page offered me the correct QuickBooks Online Sign Up. When I have known as the customer service agent quickly resolved my trouble, and now I proficiently work on QBO.often an unbiased customer service assist and guider for that product which talked about on the website and it is actually not directly or indirectly connected with any manufacturer. visit here: https://www.247quickbookshelp.com/QuickBooks-Online-Login

Comment from johnnytechshaw on 27 July 2018 at 09:41

This is absolutely wonderful and totally customer unhelpful. I should not envision this of that business and when this situation is just not gone and my deal will slide by on the writing of this article. I will honestly be defined here to show this to more relevant support such as a doable right process. With the statement of your new super elegant iPhone, I grow to feel this isn’t thought a while you'd want those types of unfavorable release. If you have any difficulty contact Apple Customer Service Number to resolve your difficulties. Visit Here: https://www.iapplesupport.com/apple-customer-service-number

Comment from QuickBooksFAQ on 27 July 2018 at 10:35

When we should classify as the customer co-operation agency immediately solved my problem, and presently I proficiently work on QuickBooks Not Responding When Opening.often an unbiased customer service assistance and guider for that product which talked about on this website and it does actually not directly or indirectly connected with any manufacturer. To benefit from Every one of these administrations which were synchronized with the QuickBooks record in a very error freeway. at least This page offered. visit here: https://quickbookscontactnumber.com/quickbooks-has-stopped-working-or-not-responding/

Comment from johnnytechshaw on 27 July 2018 at 10:49

Now call QuickBooks Support Number advice for most any assist. To get relief from each one of such companies which were synchronized co-operatively with the QuickBooks record in a much error freeway. Then, I visited the website of ouch for advice, at least this webpage available me the perfect QuickBooks Helpline Number read more assist account number. When I usually have known as the customer care agent quickly settled my queries. Visit Here: http://quickbookshelp247.com/

Comment from QuickBooksFAQ on 27 July 2018 at 11:15

Simply call QuickBooks for just about any assist. Then at least This page offered me the correct QB Contact Number. To benefit from Each one of these administrations which were synchronized with the QuickBooks account in a very error freeway. When I have known as the customer service agent quickly resolved my trouble, and now I proficiently work on QBO. visit here: https://qbsupportnumbers.com

Comment from QuickBooksFAQ on 27 July 2018 at 11:50

In order to get expert’s views, you merely ought to contact the special QB Contact Number at QB. QuickBooks is incredibly adaptable to most small organizations. It's actually a kind of business which appears to be so... Basic server possibility: Posted here, the Database supervisor could be installed on the central server, storing a corporation’s file. visit here: https://quickbookscontactnumber.com

Comment from Quickbooks Enterprise Support Phone Numbe on 12 October 2018 at 19:02

If you are new to QuickBooks Enterprise or already a long time user calling QuickBooks Enterprise Phone Number (844) 888 4666 will get you to the best support team that will answer any of your product related questions and queries. The user can call the support number any time, as the support team is available 24/7 and will respond to your call instantly without any wait time or long holds. Or visit our website: https://accountinghelpline.com/quickbooks-enterprise-support-phone-number

Comment from Quickbooks Enterprise Support Phone Numbe on 12 October 2018 at 19:03

If you are new to QuickBooks Enterprise or already a long time user calling QuickBooks Enterprise Phone Number (844) 888 4666 will get you to the best support team that will answer any of your product related questions and queries. The user can call the support number any time, as the support team is available 24/7 and will respond to your call instantly without any wait time or long holds.

Comment from HarrySmith7837 on 13 November 2018 at 05:59

If you are QuickBooks software user and facing any issue using the software, grab help from customer help team available 24*7 at QuickBooks enterprise support number to assist you. For complete Details visit:https://www.getcontacthelp.com/quickbooks/

Comment from Steve Machan on 28 November 2018 at 14:49

Its a great pleasure reading your article post.Its full of information I am looking for and I love to post a comment that "The content of your post is awesome" Visit: https://www.proaccountantadvisor.com/

Login to leave a comment