afimb / chouette

chouette is a Java program for validating and exchanging Public Transport datas. Comes with a ruby web app : https://github.com/afimb/chouette2
http://www.chouette.mobi
Other
23 stars 22 forks source link

GTFS import errors, coordinates for GTFS location_type 1, Preserve GTFS LAT & LON coordinate accuracy for NeTEx output #59

Open philosotractor opened 5 years ago

philosotractor commented 5 years ago

Hi! We're been testing GTFS to NeTEx conversion using the command line tool https://github.com/afimb/chouette/blob/master/doc/command/examples.md Could someone help by either commenting what's wrong here or by providing any documentation how to troubleshoot GTFS importing errors? Any help is appreciated :)

1) Problem: There seems to be no stop lat & lon coordinates in the generated NeTEx. By trial and error it was found out that setting in gtfs "stops.txt" the "location_type" to "1" (station) produces <Location> elements into the result with Longitude and Latitude values. How can we get coordinates to output NeTEx xml for "0" (stop) type stops as well? (For details please refer to code snippets in the end of this issue)

2) In our input material stops.txt defines LAT and LON in WSG84 projection and output NeTEx should have the same. So we set "projection_type" : "4326" in exportNetex.json. Problem: coordinates are not exactly the same in input GTFS stops.txt and output NeTEx xml Does the tool do some conversion or assignment which causes the inaccuracy, and how can we avoid that? (For details please refer to code snippets in the end of this issue)

--- Relevant code snippets of input, configuration and output data: --- shell: ./chouette.sh -i ../convert-input/importGtfs.json -o ../convert-input/exportNetex.json -f ../convert-output/netex-modified.zip ../convert-input/gtfs-modified.zip

inputReport.json:

...
      "name": "stops.txt",
      "status": "OK",
      "io_type": "INPUT",
      "check_point_errors": [
        1,
        2
      ],
      "check_point_error_count": 0,
      "check_point_warning_count": 2
    },
...

stops.txt: with location_type set to 1:

stop_id,stop_name,stop_lat,stop_lon,stop_code,stop_desc,location_type,parent_station,stop_timezone,platform_code,municipality_code
48136,Stop1 I,68.391784,23.664622,,,1,,Europe/Helsinki,,047
61737,Stop2,68.387061,23.650683,,,1,,Europe/Helsinki,,047
83664,Stop3,68.385250,23.640944,,,1,,Europe/Helsinki,,047

importGtfs.json:

{
    "gtfs-import": {
        "user_name" : "username-1",
        "name" : "job 1",
        "organisation_name" : "organisation-name-1",
        "referential_name" : "referential-name-1",
        "object_id_prefix" : "GTFS",
        "max_distance_for_connection_link" : 0,
        "max_distance_for_commercial" : 0 ,
        "ignore_end_chars" : 0,
        "ignoreLastWord" : false      }

}

exportNetex.json:

{
    "netex-export": {
        "user_name" : "username-1",
        "name" : "job 1",
        "organisation_name" : "organisation-name-1",
        "referential_name" : "referential-name-1",
        "add_metadata" : true,
        "projection_type" : "4326",
        "add_extension" : true
        }
}

Part of generated NeTEx: when location_type set to 1:

<SiteFrame version="any" id="127743:SiteFrame:SF01"> 
  <stopPlaces>
    <StopPlace version="1" id="GTFS:StopArea:48136">
     <Name>Stop 1</Name>
      <Centroid>
        <Location id="GTFS:Location:48136">
          <Longitude>23.664621353149414</Longitude>
          <Latitude>68.39178466796875</Latitude>
          <gml:pos srsName="EPSG:4326">68.39178466796875 23.6646213531494140625</gml:pos>
        </Location>
      </Centroid>
      <tariffZones>
        <TariffZoneRef version="any" ref="Local:TariffZone:0"/>
      </tariffZones>
    </StopPlace>
    <StopPlace version="1" id="GTFS:StopArea:61737">
     <Name>Stop 2</Name>
      <Centroid>
        <Location id="GTFS:Location:61737">
          <Longitude>23.65068244934082</Longitude>
          <Latitude>68.3870620727539</Latitude>
          <gml:pos srsName="EPSG:4326">68.38706207275390625 23.6506824493408203125</gml:pos>
        </Location>
      </Centroid>
      <tariffZones>
        <TariffZoneRef version="any" ref="Local:TariffZone:0"/>
      </tariffZones>
    </StopPlace>
    <StopPlace version="1" id="GTFS:StopArea:83664">
     <Name>Stop 3</Name>
      <Centroid>
        <Location id="GTFS:Location:83664">
          <Longitude>23.64094352722168</Longitude>
          <Latitude>68.38524627685547</Latitude>
          <gml:pos srsName="EPSG:4326">68.38524627685546875 23.6409435272216796875</gml:pos>
        </Location>
      </Centroid>
      <tariffZones>
        <TariffZoneRef version="any" ref="Local:TariffZone:0"/>
      </tariffZones>
    </StopPlace>
  </stopPlaces>
</SiteFrame>

Using mobi.chouette.command-3.4.8 from the maven repo.