Hi Hernan

 

I downloaded this shapefile directly via the browser. Indeed it won���t load, the type of shape file returned is

self longAt: 33 bigEndian: false -> 577660194

 

 

where it should have answered an Integer between 0 and 31

 

shapeType

         "position 32, Integer between 0 and 31, Little Endian"

 

         ^shpBytes longAt: 33 bigEndian: false

 

 

No idea what could be the cause ��� apparently the header of the file (the first 100 bytes) is not ok...

 

Hans

 

 

 

 

You mean some types are missing? Because I get this error when I try to read some SHP files: "Types > 20 are not yet accounted for"

 

I wrote this script to reproduce:

 

 | shpE legend urlRoot urlESRIFilePrefix urlESRIFileShp urlPath response fileRef |

" Download Shapefile resources "
urlRoot := 'https://github.com/nvkelso/natural-earth-vector/blob/master/110m_cultural/'.
urlESRIFilePrefix := 'ne_110m_populated_places'.
urlESRIFileShp := urlESRIFilePrefix , '.shp'.
urlPath := urlRoot , urlESRIFilePrefix.

#('.shx' '.dbf' '.shp') do: [ : ext |
| url |
url :=  (urlPath , ext , '?raw=true') asZnUrl.
(response := ZnEasy get: url) isSuccess
ifFalse: [ self error: 'Cannot download file' ].
fileRef := FileSystem disk workingDirectory / (urlESRIFilePrefix , ext).
fileRef writeStreamDo: [ : stream |
stream nextPutAll: ((ZnByteEncoder newForEncoding: 'koi8r') decodeBytes: response contents ) ] ].

 

Once downloaded:

 

| urlESRIFilePrefix urlESRIFileShp shpE |
urlESRIFilePrefix := 'ne_110m_populated_places'.
urlESRIFileShp := urlESRIFilePrefix , '.shp'.

" Load and display it in Morphic "
shpE := ShapeEnsemble fromFile: urlESRIFileShp.

 

Maybe it's related with the fact they are encoded as koi8r?

I checked with Zinc downloading first from the browser:

 

| shpFile |                                                                            
shpFile := 'ne_110m_admin_0_countries.shp' asFileReference.
[ shpFile binaryReadStreamDo: [ : in |
                (ZnCharacterEncoder detectEncoding: in upToEnd) identifier ] ]
        on: ZnCharacterEncodingError
        do: [ nil ].

 

 

Cheers,

 

Hern��n