OSMBuildings icon indicating copy to clipboard operation
OSMBuildings copied to clipboard

change the building colors

Open amoustafa93 opened this issue 4 years ago • 5 comments

Hello, i want to change the colors of those 13 buildings to red and i don't how. and also i want to change the highlight color from black to another color.

osmb

amoustafa93 avatar Sep 10 '20 13:09 amoustafa93

Hi, Please provide an example what you've tried so far. General idea: you need affected building ids and then apply a filter.

kekscom avatar Sep 10 '20 19:09 kekscom

Hello, thanks for replying I just don’t know what is the function to get the building by id and change its color to another I just need the general formula

On Sep 10, 2020, at 9:26 PM, Jan Marsch [email protected] wrote:



Hi, Please provide an example what you've tried so far. General idea: you need affected building ids and then apply a filter.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/OSMBuildings/OSMBuildings/issues/214#issuecomment-690660728, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANVQLQM3TVFNFJXRWWUQFVTSFER7RANCNFSM4RFCYISA.

amoustafa93 avatar Sep 10 '20 19:09 amoustafa93

Hello, thanks for replying I just don’t know what is the function to get the building by id and change its color to another I just need the general formula

amoustafa93 avatar Sep 15 '20 07:09 amoustafa93

This is how it works:

const map = new OSMBuildings({...});

const featureIdList = [...];

// walks through all features and if id hits your list, return a selection color
map.highlight(feature => {
  if (featureIdList.indexOf(feature.id) > -1) {
    return '#ffcc00';
  }
});

To identify buildings, you need to know their id's. You'll find these by clicking buildings on https://osmbuildings.org

I hope it helps.

kekscom avatar Sep 19 '20 19:09 kekscom

Hello,

i tried the below code and i have recieved the following error.

TypeError: map.highlight is not a function index.html:133:11

Regards, Abdelrahman


From: Jan Marsch [email protected] Sent: Saturday, September 19, 2020 9:06 PM To: OSMBuildings/OSMBuildings [email protected] Cc: amoustafa93 [email protected]; Manual [email protected] Subject: Re: [OSMBuildings/OSMBuildings] change the building colors (#214)

This is how it works:

const map = new OSMBuildings({...});

const featureIdList = [...];

// walks through all features and if id hits your list, return a selection color map.highlight(feature => { if (featureIdList.indexOf(feature.id) > -1) { return '#ffcc00'; } });

To identify buildings, you need to know their id's. You'll find these by clicking buildings on https://osmbuildings.org

I hope it helps.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/OSMBuildings/OSMBuildings/issues/214#issuecomment-695345438, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANVQLQKMETFPM5QE4CZ3DD3SGT6LHANCNFSM4RFCYISA.

amoustafa93 avatar Sep 21 '20 08:09 amoustafa93