{"id":8011,"library":"cityseer","title":"Cityseer: Urban Network Analysis","description":"Cityseer is a Python library providing computational tools for network-based pedestrian-scale urban analysis. It enables users to model urban environments, analyze accessibility, connectivity, and other urban metrics using spatial data and graph theory. The current version is 4.24.1, and it typically sees regular updates, often with significant changes between major versions.","status":"active","version":"4.24.1","language":"en","source_language":"en","source_url":"https://github.com/cityseer/cityseer","tags":["urban analysis","geospatial","network analysis","city planning","transportation","accessibility"],"install":[{"cmd":"pip install cityseer","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Core geospatial data handling and operations.","package":"geopandas"},{"reason":"Graph theory foundation for network analysis.","package":"networkx"},{"reason":"Fetching, constructing, and visualizing street networks from OpenStreetMap.","package":"osmnx"},{"reason":"Scientific computing, particularly for spatial algorithms.","package":"scipy"}],"imports":[{"note":"The City class is directly available under the top-level package namespace in v4+.","wrong":"from cityseer.city import City","symbol":"City","correct":"from cityseer import City"}],"quickstart":{"code":"import osmnx as ox\nfrom cityseer import City\n\n# Define a place and retrieve its street network using OSMnx\nplace_name = 'Piedmont, California, USA'\nG = ox.graph_from_place(place_name, network_type='walk')\n\n# Create a Cityseer City object from the OSMnx graph\ncity = City.from_osmnx(G, crs='EPSG:4326')\n\n# Perform a simple accessibility analysis\naccessibility_result = city.analyze_accessibility(target_points=city.nodes.geometry)\n\n# Print a sample of results (e.g., average accessibility)\nprint(f\"Average accessibility (example): {accessibility_result.mean():.2f}\")\n\n# To save or visualize, you would typically use city.to_gdfs() or city.draw_network()\n# For example, to get nodes with accessibility data:\n# nodes_gdf = city.nodes.copy()\n# nodes_gdf['accessibility'] = accessibility_result\n# print(nodes_gdf.head())","lang":"python","description":"This quickstart demonstrates how to create a `Cityseer` `City` object from an `OSMnx` graph and perform a basic accessibility analysis. It highlights the primary entry point (`City.from_osmnx`) and a common analysis method (`analyze_accessibility`). Ensure `osmnx` is also installed (`pip install osmnx`)."},"warnings":[{"fix":"Review the official v4 migration guide. Replace direct `graph` object manipulation and standalone functions (e.g., `graph_from_bbox`, `accessibility`) with methods on the `cityseer.City` instance (e.g., `City.from_osmnx`, `city.analyze_accessibility`).","message":"Version 4.0.0 introduced significant breaking changes, refactoring the library around a central `City` object. Many standalone functions and older `Graph` objects were removed or moved into methods of the `City` class.","severity":"breaking","affected_versions":"4.0.0+"},{"fix":"Always pass the `crs` argument with a valid EPSG code or WKT string to `City` constructors (e.g., `City('place', crs='EPSG:4326')` or `City.from_osmnx(G, crs=G.graph['crs'])`). Ensure your input data also has a defined CRS.","message":"Coordinate Reference System (CRS) handling is strict. You must explicitly provide a valid CRS (e.g., `crs='EPSG:4326'` for WGS84 or a projected CRS) when initializing a `City` object or importing data.","severity":"gotcha","affected_versions":"All v4+"},{"fix":"For initial development and testing, work with smaller, representative areas. Consider simplifying the network or processing in smaller chunks for very large regions. Monitor memory usage and execution time.","message":"Analyzing very large urban areas or extremely dense networks can lead to high memory consumption and long processing times. Cityseer is designed for pedestrian-scale analysis.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"The `Graph` object has been removed in v4. All core network operations and data are now managed by the `cityseer.City` object. Use `City.from_osmnx(graph)` or similar constructors to create a `City` object, and then access network data and methods through it (e.g., `city.nodes`, `city.edges`).","cause":"Attempting to import or use the `Graph` object or its related modules from older (v3) Cityseer versions in v4+.","error":"ModuleNotFoundError: No module named 'cityseer.graph'"},{"fix":"In v4+, `graph_from_bbox` and similar functions have been absorbed into the `City` constructor. Instead, initialize the `City` object directly with the bounding box or use `City.from_osmnx` with an already created OSMnx graph. E.g., `city = City('MyCity', bounding_box=(miny, minx, maxy, maxx), crs='EPSG:4326')`.","cause":"Calling a v3 standalone function (like `graph_from_bbox`) as a method on the new `City` object in v4+.","error":"AttributeError: 'City' object has no attribute 'graph_from_bbox'"},{"fix":"Double-check the CRS string for correctness. Common valid options are `EPSG:4326` (WGS84 lat/lon) or local projected CRS codes (e.g., `EPSG:27700` for OSGB36). Ensure `pyproj` is up-to-date. If loading from a GeoDataFrame, use `gdf.crs` directly.","cause":"The provided CRS string or object is not recognized or is malformed, often due to typos or incorrect EPSG codes.","error":"pyproj.exceptions.CRSError: Invalid CRS: ..."}]}