Skip to main content

A simple API for matching geospatial data to OSM IDs

Project description

Setup

This requires python>=3.9 but pretty specific versions of packages. If this fails, try to create a new virtual environment with python 3.9 specifically for this package.

pip install geospatial_mapper

Requirements

It needs both the OSMConflation and GeoJSON data for the target area. You can obtain both from Inrix Data Download Service provided you have an access token or login credentials.

This conflation csv should have the following features:

Feature Type Example
XDSegID Integer 136894283
OSMWayIDs Integer 19659968
OSMWayDirections String N
WayStartOffset_m Float 1077.78
WayEndOffset_m Float 1851.31
WayStartOffset_percent Float 33.706
WayEndOffset_percent Float 57.897

While the geojson data should have the following features:

Feature Type Example
OID Integer 7931440
XDSegID Integer 156418860
PreviousXD Float nan
NextXDSegI Float 395960459.0
FRC Integer 4
RoadNumber Float nan
RoadName String DRHESSRD
LinearID Float nan
Country String UNITEDSTATES
State String TENNESSEE
County String HAYWOOD
District Float nan
PostalCode String 38006
Miles Float 0.5902665205613952
Lanes Float 1.0
SlipRoad Integer 0
SpecialRoa Float nan
RoadList String DRHESSRD
StartLat Float 35.67248
StartLong Float -89.14147
EndLat Float 35.666218484838986
EndLong Float -89.13571015096953
Bearing String S
XDGroup Integer 2013963
ShapeSRID Integer 4326
geometry Geometry LINESTRING

Usage

As long as you have both the maprelease-osmconflation and maprelease-geojson for a particular area, then it should just work. It requires the county name.

  DATA_DIR = "./tests/data"
  geojson_path = os.path.join(DATA_DIR, 'maprelease-geojson.geojson')
  csv_path = os.path.join(DATA_DIR, 'maprelease-osmconflation.csv')
  county_name = ['CROCKETT']
  df = parallel(geojson_path, csv_path, county_name, threshold_distance=25)

df should have a column named county for each of the specified county and then the mapping, see the following example.

Feature Type Example
v int 202619796
key int 202705554
osmid int 0
XDSegID int 19495638
osm_geom geometry LINESTRING (-9927715.889573382 4219197.2535342...)
inrix_geom geometry LINESTRING (-9927119.795074416 4219027.3303308...)
distance float 0.000000
within_threshold bool True

Development

Test data might be proprietary but these are just the maprelease data from Inrix. Please the csv and geojson in the tests/data folder and name them test.csv and test.geojson. Pytest should succeed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geo_mapper_api-0.1.1.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geo_mapper_api-0.1.1-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file geo_mapper_api-0.1.1.tar.gz.

File metadata

  • Download URL: geo_mapper_api-0.1.1.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for geo_mapper_api-0.1.1.tar.gz
Algorithm Hash digest
SHA256 160fd9e3079ea8b8654844a2f2420aa72b08385e9e9937bdd70239cd0c561dd2
MD5 a4a8c2b7f2e13323b9d93e23f9da8b2e
BLAKE2b-256 7d6f0ae11bab3e619ed59521775088ccd6713e27f0e3613a2b7bb96ddc6643bb

See more details on using hashes here.

File details

Details for the file geo_mapper_api-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: geo_mapper_api-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for geo_mapper_api-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 13275b402d6ab103ff6f05e2585a806e1ca86218662382b9d4664506d207ed64
MD5 ada1d3d74b753b1ac15eb49f3a9cfd65
BLAKE2b-256 5b78c8bc8b7743bf0cddd2913e52fbe2543230c9c39603203b268f8bb6819cb7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page