Skip to main content

image PyPI Downloads PyPI Downloads Docs image

logo

Urban-Worm

Introduction

Urban-Worm is a Python library that integrates remote sensing imagery, street view data, and vision-language models (VLMs) to assess urban units. Using APIs for data collection and VLMs for inference, Urban-Worm is designed to support the automation of the evaluation for urban environments, including roof integrity, structural condition, landscape quality, and urban perception.

workflow

Features

  • Run VLMs locally with local datasets and ensure information privacy
  • Download building footprints from OSM and global building data released by Bing Maps, with options to filter building footprints by area
  • Search and clip aerial and street view images (via APIs) based on urban units such as parcel and building footprint data
  • Automatically calibrate the orientation of the panorama street view and the extent of the aerial image
  • Visualize results on maps and in tables
  • Interact with LLMs through a streaming chat interface to analyze and interpret results

Installation

install Ollama client

Please make sure Ollama is installed before installing urban-worm

For Linux, users can also install ollama by running in the terminal:

curl -fsSL https://ollama.com/install.sh | sh

For MacOS, users can also install ollama using brew:

brew install ollama

To install brew, run in the terminal:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Windows users should directly install the Ollama client

install GDAL first

For macOS, Linux, and Windows users, gdal may need to be installed at very begining using conda. Please download and install Anaconda to use conda.

If the installation method above does not work, try to install with conda:

 conda install -c conda-forge gdal

Mac users may install gdal (if the installation method below does not work, try to install with conda):

 brew install gdal

install the package

The package urabnworm can be installed with pip:

pip install urban-worm 

To install the development version from this repo:

pip install -e git+https://github.com/billbillbilly/urbanworm.git#egg=urban-worm

Usage

single-image inference

from urbanworm import UrbanDataSet

data = UrbanDataSet(image = '../docs/data/test1.jpg')
system = '''
    Given a top view image, you are going to roughly estimate house conditions. Your answer should be based only on your observation. 
    The format of your response must include question, answer (yes or no), explanation (within 50 words)
'''
prompt = '''
    Is there any damage on the roof?
'''
data.oneImgChat(system=system, prompt=prompt)
# output:
# {'question': 'Is there any damage on the roof?',
#  'answer': 'no',
#  'explanation': 'No visible signs of damage or wear on the roof',
#  'img': '/9j/4AAQSkZ...'}

multiple (aerial & street view) images inference using OSM data

bbox = (-83.235572,42.348092,-83.235154,42.348806)
data = UrbanDataSet()
data.bbox2Buildings(bbox)

system = '''
    Given a top view image or street view images, you are going to roughly estimate house conditions. 
    Your answer should be based only on your observation. 
    The format of your response must include question, answer (yes or no), explanation (within 50 words) for each question.
'''

prompt = {
    'top': '''
        Is there any damage on the roof?
    ''',
    'street': '''
        Is the wall missing or damaged?
        Is the yard maintained well?
    '''
}

# add the Mapillary key
data.mapillary_key = 'MLY|......'
# use both the aerial and street view images (with type='both')
data.loopUnitChat(system=system, prompt=prompt, type='both', epsg=2253)
# convert results into GeoDataframe
data.to_gdf()

More examples can be found here.

To do

  • One-shot learning in each chat method to help the model get familiar with the questions and expected answers
  • Multiple images inference for pairwise comparison and more
  • Basic plot method in UrbanDataSet class
  • Improve the method dataAnalyst in UrbanDataSet class by adding functionality of feeding a more meaningful introduction of data to LLMs
  • A web UI providing interactive operation and data visualization

The next version (v0.2.0) will have:

  • agent-based city walk simulation
  • search for a unit with an address (using Google APIs)
  • find historical images (using Google APIs)

Legal Notice

This repository and its content are provided for educational purposes only. By using the information and code provided, users acknowledge that they are using the APIs and models at their own risk and agree to comply with any applicable laws and regulations. Users who intend to download a large number of image tiles from any basemap are advised to contact the basemap provider to obtain permission before doing so. Unauthorized use of the basemap or any of its components may be a violation of copyright laws or other applicable laws and regulations.

Acknowledgements

The package is heavily built on the Ollama client and Ollama-python. Credit goes to the developers of these projects.

The functionality about sourcing and processing GIS data (satellite & street view imagery) and 360-degree street view image processing is built on the following open projects. Credit goes to the developers of these projects.

The development of this package is supported and inspired by the city of Detroit.

Metadata

Release files for urban-worm 0.0.18

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for urban-worm 0.0.18
File Size Uploaded Provenance Actions
urban_worm-0.0.18.tar.gz 1.5 MB Without provenance Details for urban_worm-0.0.18.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for urban-worm 0.0.18
File Interpreter ABI Platform Actions
urban_worm-0.0.18-py2.py3-none-any.whl Python 2, Python 3 none any Details for urban_worm-0.0.18-py2.py3-none-any.whl

Total release size: 1.5 MB

Release files / urban_worm-0.0.18.tar.gz

Download URL urban_worm-0.0.18.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
5851bc5a47c78fc492694f881eaf71ca8d51f66df012f448e41313c4e64b80d5
BLAKE2b-256 checksum
How to use checksums
38913fc11d9f9a1e878389f48a4fe42e2138c0dba215bbf0a39e3a74d1c5954b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release files / urban_worm-0.0.18-py2.py3-none-any.whl

Download URL urban_worm-0.0.18-py2.py3-none-any.whl
Size 30.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
0a001ee8603fcbacd607641012fc9288b70d63ed627748b34a2aa46c78748878
BLAKE2b-256 checksum
How to use checksums
d4562c8e01a9728931324678e22dae301f21f60413b4bbcd62999f121fe185c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Security for urban-worm 0.0.18

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.18 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page