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 geo_mapper_api

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.

  from geo_mapper_api import inrix_to_osm
        
  DATA_DIR = "./data"
  geojson_path = os.path.join(DATA_DIR, 'USA_Tennessee.geojson')
  csv_path = os.path.join(DATA_DIR, 'USA_Tennessee.csv')
  county_name = ['WILLIAMSON']

  if __name__ == '__main__':
    df = inrix_to_osm.parallel(geojson_path, csv_path, county_name, threshold_distance=25)
    df.to_csv(f"{DATA_DIR}/williamson_county_tn_inrix_osm.csv", index=False)

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.2.tar.gz (9.2 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.2-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: geo_mapper_api-0.1.2.tar.gz
  • Upload date:
  • Size: 9.2 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.2.tar.gz
Algorithm Hash digest
SHA256 cc887184a36fe44631bc148ecd17f5991966d3d18ba4c16a4ffd04a456984679
MD5 293b7e9888bbe71dd96a06f92b3c1f19
BLAKE2b-256 179e88559c864f9e21caff0315ed310e017ce0038ada31f5551743e9299cdd14

See more details on using hashes here.

File details

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

File metadata

  • Download URL: geo_mapper_api-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.3 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c6fc7c75429cd81ac9d50f88735f69fc58dde1cd8aa133fd81778deba17e34b9
MD5 1f1272571b81ce173d2a79d9055706f9
BLAKE2b-256 9f5841cee1bf8fdddd7d1664646e803ada90adfff42767dfe3909e5c5329d91b

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