Skip to content
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

Error Loading Shapefile: Missing id, source, and target Fields #276

Closed
hhtjulie opened this issue Sep 13, 2024 · 1 comment
Closed

Error Loading Shapefile: Missing id, source, and target Fields #276

hhtjulie opened this issue Sep 13, 2024 · 1 comment

Comments

@hhtjulie
Copy link

A clear and concise description of the bug: I referred to #246 & #138 to download my .shp files from OSMx, but the following bug still occurs:

[critical][network.cpp:97 ] Field not found: id index -1, source index -1, target index -1
terminate called after throwing an instance of 'std::runtime_error'
  what():  Field not found: id index -1, source index -1, target index -1
Aborted (core dumped)

I checked edges.shp, and it does not contain id index, source index, or target index.

(base) juju@JujudeMacBook-Pro stockholm % ogrinfo -al -so ./edges.shp                                                                                           
INFO: Open of ./edges.shp
      using driver ESRI Shapefile successful.

Layer name: edges
Metadata:
  DBF_DATE_LAST_UPDATE=2024-09-11
Geometry: Line String
Feature Count: 102088
Extent: (17.521229, 59.148238) - (18.389798, 59.817695)
Layer SRS WKT:
GEOGCRS["WGS 84",
    DATUM["World Geodetic System 1984",
        ELLIPSOID["WGS 84",6378137,298.257223563,
            LENGTHUNIT["metre",1]]],
    PRIMEM["Greenwich",0,
        ANGLEUNIT["degree",0.0174532925199433]],
    CS[ellipsoidal,2],
        AXIS["latitude",north,
            ORDER[1],
            ANGLEUNIT["degree",0.0174532925199433]],
        AXIS["longitude",east,
            ORDER[2],
            ANGLEUNIT["degree",0.0174532925199433]],
    ID["EPSG",4326]]
Data axis to CRS axis mapping: 2,1
u: Integer64 (18.0)
v: Integer64 (18.0)
key: Integer64 (18.0)
osmid: String (254.0)
oneway: Integer(Boolean) (1.0)
name: String (83.0)
highway: String (80.0)
maxspeed: String (80.0)
reversed: String (80.0)
length: Real (24.15)
lanes: String (80.0)
bridge: String (80.0)
access: String (80.0)
ref: String (80.0)
junction: String (80.0)
tunnel: String (80.0)
width: String (80.0)
service: String (80.0)
fid: Integer64 (18.0)

How can I resolve this?

@cyang-kth
Copy link
Owner

cyang-kth commented Sep 13, 2024

You need to explicitly specify the name of the ID, source and target column name of the network file.

This is a Python example

https://github.com/cyang-kth/osm_mapmatching?tab=readme-ov-file#2-run-map-matching-with-fmm

network = Network("network/edges.shp","fid","u","v")

For other forms of configuration like xml and arguments see

https://fmm-wiki.github.io/docs/documentation/configuration/#fmm-and-stmatch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants