Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing nogo weight when loading nogos #174

Closed
Phyks opened this issue May 8, 2019 · 2 comments · Fixed by #175
Closed

Missing nogo weight when loading nogos #174

Phyks opened this issue May 8, 2019 · 2 comments · Fixed by #175
Labels
Milestone

Comments

@Phyks
Copy link
Contributor

Phyks commented May 8, 2019

Hi,

It seems loading nogos from a GeoJSON while specifying a (positive) weight does not work and the URL for the query to the BRouter server is not updated accordingly.

It seems that when loading GeoJSON data here, the properties of the features in the GeoJSON object are not loaded by Leaflet (they should be loaded into options in Leaflet, for this part to work).

I am really not sure what is happening here, I'm almost sure this was fully tested and working when the PR got merged. Maybe this is due to a Leaflet update?

Best,

Phyks added a commit to Phyks/brouter-web that referenced this issue May 9, 2019
* Nogo weight was not set when loading nogos with a default weight
value.
* The URL would show up "NaN" values upon reloading the web interface
after having loaded some nogos.

Fix nrenner#174.
@bagage bagage added the bug label May 9, 2019
@nrenner
Copy link
Owner

nrenner commented May 9, 2019

feature.properties are not loaded into layer.options, only the options object that is passed to the GeoJSON is copied to all layers.

The commit history is lost because of squashing, but I think you first passed nogoWeight as an option to L.geoJson, and later changed it to onEachFeature to read nogoWeight from the file?

brouter-web/js/index.js

Lines 417 to 421 in 5f89287

onEachFeature: function (feature, layer) {
if (!feature.properties.nogoWeight) {
feature.properties.nogoWeight = nogoWeight;
}
}

I would prefer to manually set the layer option here instead of PR #175, something like this:

                    onEachFeature: function (feature, layer) {
                        layer.options.nogoWeight = feature.properties.nogoWeight || nogoWeight;
                    }

Phyks added a commit to Phyks/brouter-web that referenced this issue May 9, 2019
* Nogo weight was not set when loading nogos with a default weight
value.
* The URL would show up "NaN" values upon reloading the web interface
after having loaded some nogos.

Fix nrenner#174.
@Phyks
Copy link
Contributor Author

Phyks commented May 9, 2019

Indeed, this is a very nice idea to have it handled this way. I updated the PR accordingly, thanks for the feedback!

Phyks added a commit to Phyks/brouter-web that referenced this issue May 10, 2019
* Nogo weight was not set when loading nogos with a default weight
value.
* The URL would show up "NaN" values upon reloading the web interface
after having loaded some nogos.

Fix nrenner#174.
@nrenner nrenner added this to the 0.9.0 milestone May 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants