R and GML data from the Canadian Goverment

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

R and GML data from the Canadian Goverment

jcrosbie
I'm trying to create a map of transmission lines in Alberta. In addition, I'm very new to creating maps.

The data can be found at: http://geogratis.gc.ca/site/eng/download

http://ftp2.cits.rncan.gc.ca/pub/canvec/doc/CanVec_distribution_formats_en.pdf

Would someone be able to point me in the right direction? I haven't been able to find an R package which is able to work with the GML data on the webset.  Does anyone know of which package I should use and a good example out there?

Thank you
Reply | Threaded
Open this post in threaded view
|

Re: R and GML data from the Canadian Goverment

barry rowlingson
You want to have a look at the R Spatial Task View for starters...

GML files can be read by the rgdal package's readOGR function. But be
warned.... GML is a complex beast.

For example, I downloaded canvec_gml_AB_EN.zip from that site, it unzips to
a GML (and an xsd) with a lot of layers, some of which aren't spatial.

Using the ogrinfo command line tool from the gdal library I can see the
layers:

$ ogrinfo -so AB_EN.gml
Had to open data source read-only.
INFO: Open of `AB_EN.gml'
      using driver `GML' successful.
1: d_y_n (None)
2: d_y_n00 (None)
3: d_y_n01 (None)
4: d_y_n02 (None)
5: d_y_n03 (None)
6: d_y_n04 (None)
7: d_y_n05 (None)
8: d_y_n06 (None)
[etc etc]
191: d_y166 (None)
192: d_y167 (None)
193: EN_1360049_0 (Multi Point)
194: EN_1360059_2 (Multi Polygon)
195: EN_1360049_2 (Multi Polygon)
196: EN_1340009_0 (Multi Point)
197: EN_1360059_0 (Multi Point)
198: EN_2170009_0 (Multi Point)
199: EN_1120009_1 (Multi Line String)
200: EN_1180009_1 (Multi Line String)

So thats 192 non-spatial layers and a bunch of points n lines n polygons
layers. Let's read one:

m = readOGR("./AB_EN.gml","EN_1360059_2")
plot(m)

 makes a map. Its a bunch of very small polygons, hard to see really!

Further questions will be welcome at the R-sig-geo mailing list, where we
whine about file formats on a daily basis.

Barry




On Thu, May 1, 2014 at 11:26 PM, jcrosbie <[hidden email]> wrote:

> I'm trying to create a map of transmission lines in Alberta. In addition,
> I'm
> very new to creating maps.
>
> The data can be found at: http://geogratis.gc.ca/site/eng/download
>
>
> http://ftp2.cits.rncan.gc.ca/pub/canvec/doc/CanVec_distribution_formats_en.pdf
>
> Would someone be able to point me in the right direction? I haven't been
> able to find an R package which is able to work with the GML data on the
> webset.  Does anyone know of which package I should use and a good example
> out there?
>
> Thank you
>
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/R-and-GML-data-from-the-Canadian-Goverment-tp4689843.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.