[R-sig-Geo] Issue with ogrInfo

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Mon May 11 10:46:10 CEST 2015


If you go far enough into the file (which appears to be without line
breaks, so somewhere on line 1... You'll see:

"arcs":[[[7533,1255],[-1,8],[0,4],[2,3],[-1,8],[2,2],[-2,2],[-1,0],[-1,1] .....

which I think is the geometry (arcs have a start point and then x-y deltas).

I can read this file if I first convert to geojson using the command
line converter:

 $ topojson-geojson topo_wpc.json

which gives me wpc.json, and then in R:

 > d=readOGR("./wpc.json","OGRGeoJSON")
OGR data source with driver: GeoJSON
Source: "./wpc.json", layer: "OGRGeoJSON"
with 632 features and 3 fields
Feature type: wkbPolygon with 2 dimensions

Hmmmm

Barry




On Sun, May 10, 2015 at 6:38 PM, Roger Bivand <Roger.Bivand at nhh.no> wrote:
> On Sun, 10 May 2015, Barry Rowlingson wrote:
>
>> On Sun, May 10, 2015 at 4:31 PM, Daniel Marcelino <dmarcelino at live.com>
>> wrote:
>>>
>>> Dear all, I'm having the following issue when trying to read a
>>> topographical json file:
>>
>>
>> That's a **topological**  (not topographical) geojson file. Instead
>> of recording each polygon separately, and thus duplicating common
>> boundaries, a topojson file stores all the line segments once, and
>> then defines polygons as which sequence of line segments draws the
>> polygon.
>>
>> I'm guessing your ogr library doesn't have topojson support. Does the
>> output of ogrDrivers() agree with me?
>>
>> Solution is usually "use gdal/ogr tools to convert to plain old
>> geojson (ogr2ogr)"
>
>
> Right, but while the geojson driver does read topojson from 1.11, ogrinfo
> says no-go. On inspecting the file, it appears only to contain lost of links
> to other stuff and no geometries that I (or OGR) recognise. The geometries
> must be hidden in one of the links, but are not exposed.
>
> Roger
>
>>
>>
>> Barry
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
> --
> Roger Bivand
> Department of Economics, Norwegian School of Economics,
> Helleveien 30, N-5045 Bergen, Norway.
> voice: +47 55 95 93 55; fax +47 55 95 91 00
> e-mail: Roger.Bivand at nhh.no
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list