I would like to convert the tree inventory shape files of London (Canada) into a GPX file and if possible into a JSON file. You can download the archive from their Open Data website. It contains the following files.
READ_ME.txt
TREEINV_SPECIES.xml
TREEINV_SPECIES.xsd
TREES.DBF
trees.gpx
trees.sbn
trees.sbx
trees.shp
trees.shp.xml
trees.shx
Today, I stumbled into ogr2ogr and tried the following command.
$ ogr2ogr -f GPX trees.gpx trees.shp
Though, the following error occurs.
ogr2ogr ERROR 1: Latitude is invalid. Valid range is [-90,90].
This warning will not be issued any more
I already found a similar question but cannot figure out what the problem is. Please mind, I am totally new to the topic of converting geographic data. If you know any better tool I am willing to try it out.
EDIT: An initial success story.
According to the answers of Aragon and Brent Edwards I came up with the following commands. I found a webpage stating that data can be ordered in NAD83. So I assume that the dataset I am trying to convert comes as NAD83 as well. However, I cannot understand how I can find out the EPSG resp. SRID myself. With the given information I can lookup EPSG:26917 in the EPSG Geodetic Parameter Registry - but if I have no clue what the number is - how would I do that?
$ ogr2ogr -f GeoJSON -s_srs EPSG:26917 -t_srs EPSG:4326 trees_coordinates.json trees.shp
$ ogr2ogr -f GeoJSON -s_srs EPSG:26917 TREES_properties.json TREES.DBF
The converted GeoJSON files contain the following data.
// Example rows from trees_coordinates.json
{
"type": "FeatureCollection",
"features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ -81.233494, 42.994146 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ -81.232346, 42.994477 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ -81.232176, 42.994527 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ -81.245137, 42.971636 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ -81.189495, 42.996498 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ -81.189651, 42.996442 ] } }
]
}
And ..
// Example rows from TREES_properties.json
{
"type": "FeatureCollection",
"features": [
{ "type": "Feature", "properties": { "TREEID": 19.000000, "DIAMETER": 53.000000, "SPECIES": "MASU" }, "geometry": null }
,
{ "type": "Feature", "properties": { "TREEID": 23.000000, "DIAMETER": 30.000000, "SPECIES": "MANO" }, "geometry": null }
,
{ "type": "Feature", "properties": { "TREEID": 24.000000, "DIAMETER": 53.000000, "SPECIES": "MASI" }, "geometry": null }
,
{ "type": "Feature", "properties": { "TREEID": 104920.000000, "DIAMETER": 5.000000, "SPECIES": "OAWH" }, "geometry": null }
,
{ "type": "Feature", "properties": { "TREEID": 60358.000000, "DIAMETER": 34.000000, "SPECIES": "MAMA" }, "geometry": null }
,
{ "type": "Feature", "properties": { "TREEID": 60355.000000, "DIAMETER": 51.000000, "SPECIES": "MASU" }, "geometry": null }
]
}
Questions:
- Are my commands correct?
- How can I match the rows of both files? Which property set belongs to which GPS position? Is their a way to combine both in one file? I saw another format that includes all information in one file.
- How can I find out the EPSG/SRID and SRS in general if I have nothing more than those files listed in the beginning of my question?