-
Notifications
You must be signed in to change notification settings - Fork 83
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
Basemapper allow for in memory BytesIO GeoJSON for boundary param #204
Basemapper allow for in memory BytesIO GeoJSON for boundary param #204
Comments
Hello, I am an Outreachy applicant, Could you please provide additional details on how I can begin working on this project, particularly setting it up locally on my machine? @spwoodcock |
@ohthebrave I updated the description to include a lot more instructions, including how to set up the repo and run the code. Hope this helps! |
Good idea to use BytesIO for this, I prefer to use memory as much as possible instead of disk files. Course we still need the disk file, but it can be produced from what's in memory. Before FMTM, basemapper was only used standalone in a terminal, so the file was fine. But using memory is better when part of a backend API. |
Thanks for the instructions on setting up the repo and running the code @spwoodcock |
Thank you for providing guidance on configuring the repository and executing the code. @spwoodcock |
Hello mentor, @spwoodcock I trust this message finds you well. I'm currently contributing to the osm-fieldwork project. Unfortunately, I've encountered an issue with joining the Slack community associated with this project. As mentioned in the guidelines, I have made a contribution to my fork repository, and you can find the link to my pull request here: donaldte#1 Thank you for your attention to this matter. Best regards, |
For someone who may encounter |
Hello @spwoodcock , I have sent the link to my PR for this task, looking forward to your feedback. Thank you |
The underlying package this installs to fix the issue is |
… in reference to issue hotosm#204
Hello @spwoodcock, I was getting confused with the output file while running the code. MainThread - main - INFO - Downloading 1 tiles in thread 15308 to C:\Users\Sahana K\Desktop\Outreachy\osm-fieldwork\esritiles The command that I used to run the basemapper.py was: I would really appreciate if you would take some time and help me with this as I am new to open source. Thank you so much for your time on this matter. |
If you can see the tile images in the esritiles directory, then the script was successful. You can bundle the images to an mbtiles file, but it's not mandatory. Use the |
I would like to contribute to this project |
@spwoodcock, I'm an Outreachy intern interested in contributing to this project. After reviewing the repository, I noticed there aren't any good first issues available. Could you please guide me on where to start my contribution? |
Hello, if you're an outreachy applicant, you could work on the task above, as it is a general issue open to all applicants. |
Hello @spwoodcock, I'm an Outreachy applicant interested in contributing to this project. I have done most of the required work, but haven't created a pull request yet. I've been trying to join the slack channel using my gmail, but I keep getting an error message that my email doesn't match the domain. How do I fix this? Or is it ok to submit the task without joining the slack channel? ***Update: I got a new link that worked. Thank you @petya-kangalova |
Hey @spwoodcock, I'm an outreachy applicant and I wanted to thank you for your detailed description of the task. It has been incredibly helpful in navigating the project. |
@endurijahnavi thank you for the nice feedback. Apologies for the issues with joining Slack- I have now sent an invite request to your email. If any issues, please drop me an email to [email protected] |
I will revert with a PR link shortly |
@spwoodcock I sent my PR link to your slack inbox as instructed, almost 2 weeks ago, and I haven't gotten a feedback. Here it is again, just in case medinasheriff#1 |
Please look into this @spwoodcock |
Sorry for that problem before. Can you please check the updated one. |
Outreachy Task
MBTile Basemaps
The Current Implementation
bbox
.x_min, y_min, x_max, y_max
:The Issue
bytes
object).bytes
wrapped in aBytesIO
wrapper).The Solution
main()
function that is only used when running basemapper via the command line. The file should be read and converted to BytesIO object, before passing through to thecreate_basemap_file
function.Instructions
Set up your repo
Fork the osm-fieldwork repository: https://github.com/hotosm/osm-fieldwork/fork
Clone the forked repository to your filesystem and create a new branch:
Solve the problem by writing and committing new code.
Create a pull request from your new branch to the
main
branch within your forked repo (please do not create a pull request against the hotosm/osm-fieldwork repo).Prerequisites
Install PDM:
Install the dependencies for osm-fieldwork:
Testing your code
To save time and overloading networks, I would recommend building a minimal basemap during testing by using the command specified below.
There is a command line interface to basemapper that works like:
pdm run python osm_fieldwork/basemapper.py -b -4.730494 41.650541 -4.725634 41.652874 -z 12-15 -s esri # Or via geojson file pdm run python osm_fieldwork/basemapper.py -b yourbbox.geojson -z 12-15 -s esri
As you can see the boundary is passed in using flag
-b
and can be a bounding box or GeoJSON file.The goal of this task is to allow for passing the GeoJSON file in-memory when using basemapper via a script.
Using via Python script
Create a file
outreachy.py
in the repo of your code repository:Run the file to generate a
.mbtiles
archive:Using via PyTest
This method is slightly more complex, requiring Docker to be installed.
You may skip this step if necessary.
Open the existing
tests/test_basemap.py
file to see the current test.Run the test from the code repository root:
Writing your solution
You will need to modify
create_basemap_file
inbasemapper.py
so that theboundary
parameter accepts a BytesIO object, in addition to a bounding box or geojson file.In the end, we want to be able to use the function like this:
Important notes on submission
Your code should not be submitted through email, slack, a PR to this repository, or any other means.
main
branch on your fork.outreachy
channel on Slack, so that everyone can benefit.FAQ
Issues installing psycopg2
psycopg2 requires
libpq-dev
to be installed on your system.In short there are solutions for each OS below:
Ubuntu/Debian
sudo apt update sudo apt install -y libpq-dev gcc pdm install -G test
MacOS
brew install libpq gcc pdm install -G test
Windows
(requires a workaround, try either)
pip install pipwin pipwin install psycopg2 pip uninstall pipwin pdm install -G test
or
pdm add https://download.lfd.uci.edu/pythonlibs/archived/psycopg2-2.9.3-cp310-cp310-win_amd64.whl pdm install -G test
The text was updated successfully, but these errors were encountered: