Ejemplo n.º 1
0
 /// <summary>
 /// Create a new Overpass query result.
 /// </summary>
 /// <param name="OverpassQuery">The original Overpass query.</param>
 /// <param name="Result">An OverpassAPI result.</param>
 public OverpassResult(OverpassQuery OverpassQuery,
                       JObject Result)
 {
     Query                = OverpassQuery;
     Version              = Result["version"].ToString();
     Generator            = Result["generator"].ToString();
     Copyright            = Result["osm3s"]["copyright"].ToString();
     timestamp_osm_base   = DateTime.Parse(Result["osm3s"]["timestamp_osm_base"].ToString());
     timestamp_areas_base = Result["osm3s"]["timestamp_areas_base"] != null ? new Nullable <DateTime>(DateTime.Parse(Result["osm3s"]["timestamp_areas_base"].ToString())) : null;
     Elements             = Result["elements"].Children <JObject>().ToArray();
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Run the given Overpass query and convert the result to GeoJSON.
 /// </summary>
 /// <param name="OverpassQuery">An Overpass query.</param>
 public static Task <FeatureCollection> ToGeoJSONAsync(this OverpassQuery OverpassQuery)
 {
     return(OverpassQuery.
            RunQueryAsync().
            ToGeoJSONAsync());
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Run the given Overpass query, cenvert the result to GeoJSON and write it to the given file.
 /// </summary>
 /// <param name="OverpassQuery">An Overpass query.</param>
 /// <param name="Filename">A file name.</param>
 public static Task <FeatureCollection> ToGeoJSONFileAsync(this OverpassQuery OverpassQuery, String Filename)
 {
     return(OverpassQuery.
            RunQueryAsync().
            ToGeoJSONFileAsync(Filename));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Run the given Overpass query and write the result to the given file.
 /// </summary>
 /// <param name="OverpassQuery">An Overpass query.</param>
 /// <param name="Filename">A file name.</param>
 public static Task <OverpassResult> ToFileAsync(this OverpassQuery OverpassQuery, String Filename)
 {
     return(OverpassQuery.
            RunQueryAsync().
            ToFileAsync(Filename));
 }