I download .shp and .dbf files for roads, extract it and save to database. I display points with the same name as the street on my own Google Map.

This is how it looks like:

enter image description here

I found that not each point across the road have the same "osmId", so how to get all coordinates across all road. This is how it looks like when I put osmId on markers, there are different (the first row is "osmId"):

enter image description here

When I extract this data i had field called "name" - it means name of road. But this name is not unique, there are several roads with the same name. This is an example of data extracted from .shp and .dbf file:

"geometry" : {
    "coordinates" : [
    "type" : "LineString"
"type" : "Feature",
"properties" : {
    "osm_id" : "2954554",
    "code" : "5122",
    "fclass" : "residential",
    "name" : "Ignacego Mościckiego",
    "ref" : null,
    "oneway" : "B",
    "maxspeed" : 40,
    "layer" : 0,
    "bridge" : "F",
    "tunnel" : "F"

There is no some kind of unique id field that can tell me that this data is connected with also other parts of data and together they created a unique road. So how to get all points across the specific road? Is it possible? I extract data from .shp and .dbf files.

  • 1
    The shapefile format requires .shp,.shx, and .dbf suffix files and should always include a .prj. If you don't get all the files available with the same prefix, you are corrupting the dataset. – Vince Sep 19 '20 at 12:45
  • What other types od fields should i have ? – Marcin Warzybok Sep 19 '20 at 13:17

OSM data is split into segments ("ways", in OSM parlance) whenever any property changes (name, surface, width, legality of herding yaks, ...). You have to decide what you mean by "the same road", assemble the bits that join up geometrically, and cut up the result according to your definition of "the same road".

This might be easier to do working with the original OSM data (in XML or .osm.pbf format), since it contains explicit information about what is joined up with what, which gets lost in the conversion to a shapefile.

The OSM XML format is described at https://wiki.openstreetmap.org/wiki/OSM_XML . The .osm.pbf format has the same structure, it's just encoded more efficiently.

  • No, the situation is the same - unfortunately. – Marcin Warzybok Sep 23 '20 at 20:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.