[R-sig-Geo] Importing only lines from big shape file

Roger Bivand Roger.Bivand at nhh.no
Thu Apr 24 19:23:56 CEST 2014


On Thu, 24 Apr 2014, Agus Camacho wrote:

> I think i might have not made myself clear in first place:
>
> I want the lines from mata_atlantica.shp, but those are much more than
> shorelines.
> They are inland polygons.

Then you'll need a machine with a lot of memory. The URL you gave does not 
lead to any single shapefile, but to:

/mata_atlantica/dados/shape_file/folhas

and folders recortes_elim and recortes_9x9_MA, both of which include many 
shapefiles.

The key question is why you need to read detailed boundary data into R, 
and we do not know the answer. If there are inland polygons, then GSHHS 
will not help.

Roger

>
> thanks
>
>
> 2014-04-24 14:07 GMT-03:00 Agus Camacho <agus.camacho at gmail.com>:
>
>> Thanks Roger,
>>
>> I didnt get what you mean with the intermediate binary dataset, you mean
>> the mata_atlantica.shp file (420,241KB)?
>>
>> I tried maptools::Rgshhs and also getRgshhsMap but got the error:
>>
>> Error in Rgshhs(fn, xlim = xl.west, ylim = ylim, shift = shift, level =
>> level,  :
>>   Data not same version as software
>>
>>
>>
>> 2014-04-24 13:47 GMT-03:00 Roger Bivand <Roger.Bivand at nhh.no>:
>>
>> On Thu, 24 Apr 2014, Agus Camacho wrote:
>>>
>>>  Thanks for the fast response,
>>>>
>>>> @ Barry
>>>> The .shp file is 420,241KB, the .shx is 6,994KB and the .dbf is
>>>> 1,729,941KB.
>>>> @ Javier, id like to use the whole region.
>>>>
>>>
>>> But you'll never be able to render the detail in this coastline anyway.
>>> Why not just use maptools::Rgshhs with the intermediate binary dataset,
>>> setting a sensible bounding box? I've had trouble with the newest fine data
>>> set and with the equivalent 2.3.0 shapefile (missing Norwegian islands),
>>> but an older version (2.1.0) was fine.
>>>
>>> Roger
>>>
>>>
>>>
>>>
>>>> Might be any easy way to reduce the number of vertex previously to
>>>> import?
>>>>
>>>> These shape files are available at:
>>>> http://mapas.mma.gov.br/mapas/aplic/probio/datadownload.htm
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> 2014-04-24 13:02 GMT-03:00 Javier Garcia-Pintado <
>>>> j.garcia-pintado at reading.ac.uk>:
>>>>
>>>>  A possibility is, if you are interested in some specific area of the
>>>>> mata
>>>>> atlantica, to crop the file externally with OGR just for your study
>>>>> area,
>>>>> and read the cropped file into R.
>>>>>
>>>>> Javier
>>>>> ---
>>>>> __________
>>>>> From: r-sig-geo-bounces at r-project.org [r-sig-geo-bounces at r-project.org]
>>>>> on behalf of Barry Rowlingson [b.rowlingson at lancaster.ac.uk]
>>>>> Sent: 24 April 2014 16:58
>>>>> To: Agus Camacho
>>>>> Cc: r-sig-geo
>>>>> Subject: Re: [R-sig-Geo] Importing only lines from big shape file
>>>>>
>>>>> On Thu, Apr 24, 2014 at 4:47 PM, Agus Camacho <agus.camacho at gmail.com
>>>>>
>>>>>> wrote:
>>>>>>
>>>>>
>>>>>  Dear Rgeos,
>>>>>>
>>>>>> Id like to know if there is some workaround to import  the lines
>>>>>>
>>>>> contained
>>>>>
>>>>>> by a shape file, avoiding memory problems when the only thing you need
>>>>>> is
>>>>>> the lines it contains.
>>>>>>
>>>>>> I mean, reading the lines of the world's coast lines can be done in a
>>>>>> instant with:
>>>>>>
>>>>>> wcoastline <- PBSmapping::importShapefile("GSHHS_c_L1.shp")#
>>>>>>
>>>>>> However, reading a relatively small region, like the brazilian atlantic
>>>>>> forest, seems impossible for my little laptop.  I tried all of these
>>>>>> possibilities.
>>>>>>
>>>>>> AF=PBSmapping::importShapefile("mata_atlantica.shp")
>>>>>> AF=rgdal::readOGR("dir",layer="mata_atlantica")
>>>>>> AF=shapefiles::read.shp("mata_atlantica.shp")
>>>>>>
>>>>>> Any hint would be very welcome.
>>>>>>
>>>>>>
>>>>>  Ummm not sure this makes sense. You can read all the coastlines, but
>>>>> not
>>>>> some of the coastlines?
>>>>>
>>>>>  Are the mata_atlantica  files bigger because they are more detailed?
>>>>> Sometimes global data is generalized.
>>>>>
>>>>>  Show us the size in bytes of the files...
>>>>>
>>>>> Barry
>>>>>
>>>>>         [[alternative HTML version deleted]]
>>>>>
>>>>> _______________________________________________
>>>>> 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
>>>
>>>
>>
>>
>> --
>> Agustín Camacho Guerrero.
>> Doutor em Zoologia.
>> Laboratório de Herpetologia, Departamento de Zoologia, Instituto de
>> Biociências, USP.
>> Rua do Matão, trav. 14, nº 321, Cidade Universitária,
>> São Paulo - SP, CEP: 05508-090, Brasil.
>>
>
>
>
>

-- 
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


More information about the R-sig-Geo mailing list