-
Notifications
You must be signed in to change notification settings - Fork 11
ch04_thematic question #2
Comments
Hi, Just checked this with v3.15.1, and v3.16.0. The headers are set correctly, however, as you guessed it right, the |
Well, I'm glad I'm not the only one. I was going crazy trying to figure this out. Still, it doesn't make any sense. Thanks for checking. |
Fixed. So I just added the line, Checks good with v3.11.0, v3.12.0 and v3.16.0. If you think of a more appropriate solution, I'd be interested in hearing about it. |
Okay, so first of all, thanks for your help with the debugging. Your findings leaded to the solution. The case is, there is a "new" logic in OL3, which prevents the setters from running, when the new value equals to the old one. What the old code did: var headers = this.get('headers') || {}; So what did it grab? The pointer to the for (var i = 0; i < features.length; i += 1) {
var attributes = features[i].getProperties();
for (var j in attributes) {
if (typeof attributes[j] !== 'object' && !(j in headers)) {
headers[j] = 'string';
}
}
} we can see, that the code updates the The last piece of the puzzle: why the list wasn't populated when map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
source: new ol.source.OSM(),
name: 'OpenStreetMap'
}),
new ol.layer.Vector({
source: new ol.source.Vector({
format: new ol.format.GeoJSON({
defaultDataProjection: 'EPSG:4326'
}),
url: '../../res/world_countries.geojson'
}),
name: 'World Countries',
headers: {
pop_est: 'integer',
gdp_md_est: 'integer'
}
})
], You can see my solution to this issue at 72dd869, I just messed up the issue number. |
Hello,
I was playing around with your example "ch04_thematic" and noticed that the drop down menu displays the properties (e.g. pop_est, name, etc.) correctly with ol v3.11.0 or older, but is empty when using ol v3.12.0 or newer. The problem seems to be related to the
buildHeaders
function not calling the line,this.set('headers', headers)
. Or maybe the headers are getting set but thepropertychange
event isn't firing. I've isolated it down that far, but am running out of debugging ideas.I compared the
ol.layer.Vector
documentation between v3.11.0 and v3.12.0. There is no noticeable difference that I can see between the two versions which makes me think it's a problem on my end. I've been at this for hours and still cannot find the source of the error. Are you aware of anything that might be causing this?Thanks,
The text was updated successfully, but these errors were encountered: