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

Skipping Buildings? #4

Closed
pachacamac opened this issue Sep 13, 2018 · 3 comments
Closed

Skipping Buildings? #4

pachacamac opened this issue Sep 13, 2018 · 3 comments

Comments

@pachacamac
Copy link

What would be the best approach to skip buildings altogether? I'm only looking to simulate agents on a street network and I want the street network to be considerably bigger than in the demos (whole city if possible). Awesome library btw! Thank you for your work!

@noncomputable
Copy link
Owner

noncomputable commented Sep 13, 2018

Thank you!

For the last parameter of Agentmap.buildingify, units_data, you can provide an empty feature collection like this: {type:"FeatureCollection", features:[]}, and no units will be built. If you just provide an empty object {}, Leaflet will throw Uncaught Error: Invalid GeoJSON object, but I might deal with that to make the "no units" option more convenient.

Alternatively, if you installed the package and are using a bundler, you can import setupStreetFeatures from buildings.js alone and call it in your agentmap's context to only build the streets.

You could also just call Agentmap.buildingify normally and then Agentmap.units.clearLayers() or Map.removeLayer(agentmap.units) to erase them, but that seems a little inefficient.

@pachacamac
Copy link
Author

Thank you for your response! I think I tried providing an empty feature collection like you suggested but still ran into problems. I'm sure this was a problem on my end though. However I couldn't get any usable performance done when I used slightly bigger maps, like a full district or city. Did you manage to use it on bigger maps?

@noncomputable
Copy link
Owner

noncomputable commented Sep 19, 2018

Ah, alright! You ought to add reproduction info to make it easier for anyone looking at the issue to get to the bottom of it!

If some dataset is giving you trouble, please share it so we can test. I'll put up a tool to let users generate units and streets without having to load them in a browser.

I've added a command line tool that makes dealing with bigger datasets easier. See the "generating buildings" section of the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants