Pharo-users
By thread
pharo-users@lists.pharo.org
By month
Messages by month
- ----- 2026 -----
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
June 2020
- 63 participants
- 235 messages
Re: [Pharo-users] shape file reading
by Stéphane Ducasse
Please add this to the readme :)
> On 5 Jun 2020, at 23:19, Hernán Morales Durand <hernan.morales(a)gmail.com> wrote:
>
>
>
> El vie., 5 jun. 2020 a las 9:27, Baveco, Hans (<hans.baveco(a)wur.nl <mailto:hans.baveco@wur.nl>>) escribió:
> Well, it appears that simple direct downloading does not download the real shapefile. Taking care to actually get a shapefile, the result loads without problems.
>
> ne_110m_populated_places.shp is a PointShape with 243 shapes (points). If you display it on a Form (#displayMorphic) you wonât see much (243 hardly visible dots).
>
>
>
>
> I checked and my previous download method was completely wrong. Now switching from ZnEasy to ZnClient to download and it works nicely:
>
> | shpE legend urlRoot urlESRIFilePrefix urlESRIFileShp urlPath response fileRef |
>
> " Download Shapefile resources "
> urlRoot := 'https://github.com/nvkelso/natural-earth-vector/blob/master/110m_cultural/ <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' '.cpg' '.prj') do: [ : ext |
> ZnClient new
> url: (urlPath , ext) asZnUrl;
> queryAt: 'raw' put: 'true';
> numberOfRetries: 2;
> enforceHttpSuccess: true;
> downloadTo: urlESRIFilePrefix , ext;
> get ].
>
> " Load and display it in Morphic "
> shpE := ShapeEnsemble fromFile: urlESRIFileShp.
> " List data fields "
> shpE dataFields inspect.
> " List all shape records "
> shpE shapeRecords inspect.
> " Set the current attribute "
> shpE attribute: 'NAME'.
>
> legend := ColorLegend mapValuesToRandom: shpE valuesOfCurrentAttribute.
> shpE legend: legend.
>
> shpE displayMorphic.
>
> With an application for vector graphics (Roassal?) that can read & display the vector data we would get much nicer maps...
>
>
>
> Hans
>
>
>
> From: Baveco, Hans <hans.baveco(a)wur.nl <mailto:hans.baveco@wur.nl>>
> Sent: vrijdag 5 juni 2020 12:44
> To: Any question about pharo is welcome <pharo-users(a)lists.pharo.org <mailto:pharo-users@lists.pharo.org>>
> Subject: [Pharo-users] shape file reading
>
>
>
> 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/ <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
>
>
>
>
>
--------------------------------------------
Stéphane Ducasse
http://stephane.ducasse.free.fr / http://www.pharo.org
03 59 35 87 52
Assistant: Aurore Dalle
FAX 03 59 57 78 50
TEL 03 59 35 86 16
S. Ducasse - Inria
40, avenue Halley,
Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
Villeneuve d'Ascq 59650
France
June 6, 2020
Re: [Pharo-users] Class hierarchy diagram
by Sanjay Minni
I really find this (Roassal3) very useful, I have a few queries / requests
In the UML-Package view:
- Why is it that some of the classes in the "UML-Package" view appear as
[<MyClassName> class] and their class side methods are shown and not
instance side
- can we always show class side methods followed by a separator and then
instance side methods. This may not be a standard but it would be useful
- When I hover over a top level class in the view can the popup show also
the superClass name as [Superclass>>ThisClass]
eftomi wrote
> With Roassal3 you get a diagram in the browser like this, on the tab
> "UML-Class" and "UML-Package".
>
>
> Best wishes,
> Tomaz
>
> c1buzqwa.png (121K)
> <http://forum.world.st/attachment/5117496/0/c1buzqwa.png>
-----
cheers,
Sanjay
--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
June 6, 2020
Re: [Pharo-users] shape file reading
by Hernán Morales Durand
El vie., 5 jun. 2020 a las 9:27, Baveco, Hans (<hans.baveco(a)wur.nl>)
escribió:
> Well, it appears that simple direct downloading does not download the real
> shapefile. Taking care to actually get a shapefile, the result loads
> without problems.
>
> ne_110m_populated_places.shp is a PointShape with 243 shapes (points). If
> you display it on a Form (#displayMorphic) you wonât see much (243 hardly
> visible dots).
>
>
>
I checked and my previous download method was completely wrong. Now
switching from ZnEasy to ZnClient to download and it works nicely:
| 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' '.cpg' '.prj') do: [ : ext |
ZnClient new
url: (urlPath , ext) asZnUrl;
queryAt: 'raw' put: 'true';
numberOfRetries: 2;
enforceHttpSuccess: true;
downloadTo: urlESRIFilePrefix , ext;
get ].
" Load and display it in Morphic "
shpE := ShapeEnsemble fromFile: urlESRIFileShp.
" List data fields "
shpE dataFields inspect.
" List all shape records "
shpE shapeRecords inspect.
" Set the current attribute "
shpE attribute: 'NAME'.
legend := ColorLegend mapValuesToRandom: shpE valuesOfCurrentAttribute.
shpE legend: legend.
shpE displayMorphic.
> With an application for vector graphics (Roassal?) that can read & display
> the vector data we would get much nicer maps...
>
>
>
> Hans
>
>
>
> *From:* Baveco, Hans <hans.baveco(a)wur.nl>
> *Sent:* vrijdag 5 juni 2020 12:44
> *To:* Any question about pharo is welcome <pharo-users(a)lists.pharo.org>
> *Subject:* [Pharo-users] shape file reading
>
>
>
> 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
>
>
>
>
>
>
June 5, 2020
Fwd: GIS support for Pharo
by Hernán Morales Durand
---------- Forwarded message ---------
De: Hernán Morales Durand <hernan.morales(a)gmail.com>
Date: vie., 5 jun. 2020 a las 16:54
Subject: Re: [Pharo-users] GIS support for Pharo
To: Baveco, Hans <hans.baveco(a)wur.nl>
El vie., 5 jun. 2020 a las 4:27, Baveco, Hans (<hans.baveco(a)wur.nl>)
escribió:
> Thanks Hernan!
>
>
>
> I will try to find out what the problem is with your shape file.
>
>
>
> Btw is the code for reading/writing dbf files already available on github?
>
>
>
Yes it is: https://github.com/hernanmd/XBase
Cheers,
Hernán
> Hans
>
>
>
> *From:* Hernán Morales Durand <hernan.morales(a)gmail.com>
> *Sent:* vrijdag 5 juni 2020 0:25
> *To:* Any question about pharo is welcome <pharo-users(a)lists.pharo.org>
> *Subject:* Re: [Pharo-users] GIS support for Pharo
>
>
>
> Hi Hans,
>
>
>
>
>
> El jue., 4 jun. 2020 a las 6:07, Baveco, Hans (<hans.baveco(a)wur.nl>)
> escribió:
>
> Would be an interesting project..
>
> An old link to possibly still useful code:
>
>
>
> http://wiki.squeak.org/squeak/3317
>
>
>
>
>
> Btw the shapefile support, from the ESRI spec, was done by me and is still
> available on http://www.squeaksource.com/@CUT95k_uXmPU4uXY/HCmgtrop.
>
>
>
> Thank you for the clarification (and actually sharing your work with ESRI
> files!)
>
> I added proper credits in the Github forked repo :
> https://github.com/hernanmd/Shapes
>
>
>
> I use it daily. I may have some fixes/additions, but in general the code
> as provided works well (I suppose the code at smalltalkhub is still mostly
> the same). Some shapefile formats are still missing, mostly because I never
> encountered them..
>
>
>
> 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
>
>
>
> To read a complete shapefile one also needs to read dbf files. This was
> another substantial effort
> http://www.squeaksource.com/@Y4HhnL90iyA2TmAb/X0sPqshM; luckily there
> was an older implementation.available to build upon.
>
> Not sure whether nowadays there are other ways to read/write files old
> DBASE format files...
>
>
>
> Cheers,
>
>
>
> Hans Baveco
>
>
>
>
>
>
>
>
>
> *From:* Serge Stinckwich <serge.stinckwich(a)gmail.com>
> *Sent:* donderdag 4 juni 2020 5:32
> *To:* Any question about pharo is welcome <pharo-users(a)lists.pharo.org>
> *Subject:* [Pharo-users] GIS support for Pharo
>
>
>
> Dear all,
>
>
>
> there was already some discussion in the list about GIS support for Pharo
> previously.
>
>
>
> Working on CORMAS multi-agent simulation platform:
> https://github.com/cormas/cormas some developers feel the need to have
> more GIS support for Pharo.
>
>
>
> I know of existing GIS software:
>
> - GeoJSON by Zweidenker: https://github.com/zweidenker/GeoJSON
>
> - ESRI ascii raster, done by Stephane recently:
> https://github.com/Ducasse/ESRI-ASCII-Raster
>
> - shapefile support by Hernan: http://smalltalkhub.com/#!/~hernan/Shapes
>
> (to be moved to github)
>
> - I found this project also: http://www.squeaksource.com/gekon.html
>
>
>
> I know that Etienne Delay is also interested by GIS support and propose to
> implement OpenGIS model support:
> https://github.com/cormas/cormas/issues/139
>
>
>
> Can we try to unite and maybe create a pharo-GIS organization on github to
> federate our efforts?
>
>
> Cheers,
>
> --
>
> Serge Stinckwic
>
> h
>
> https://twitter.com/SergeStinckwich
>
>
>
>
June 5, 2020
Re: [Pharo-users] Zinc WebSocket usage
by Erik Stel
Sven,
Okay. Thx for spending your time to investigate this. I'll stick with the
current workaround then.
Cheers,
Erik
--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
June 5, 2020
Re: [Pharo-users] Zinc WebSocket usage
by Sven Van Caekenberghe
Erik,
I can't explain why this condition is holding (when a read is pending, closing the socket stream has no effect until the timeout expires, all client side).
I would stick with your solution:
| server client |
server := ZnWebSocket startServerOn: 1701 do: [ :webSocket |
[ webSocket runWith: [ :message | Transcript show: 'Received message: ', message
printString; cr ] ]
on: ConnectionClosed, PrimitiveFailed do: [ "ignore close" ].
Transcript show: 'The server websocket is closed @ ' , DateAndTime now asString; cr ].
client := ZnWebSocket to: 'ws://localhost:1701'.
[
[ client runWith: [ :message | "ignore received messages" ] ]
on: ConnectionClosed, PrimitiveFailed do: [ "ignore close" ].
Transcript show: 'The client websocket is closed @ ' , DateAndTime now asString; cr.
server stop ] fork.
10 milliSeconds wait.
client sendMessage: 'Hello world! #' , 999 atRandom asString.
"client close."
"Workaround: use the following instead of 'client close'."
client sendFrame: ZnWebSocketFrame close.
{ server. client }.
I checked and no resources are lost at the end (the socket/stream gets cleaned up).
I would lower the timeout in any case, 30s is way too long, I would go for 5s or 10s.
Sven
> On 5 Jun 2020, at 09:55, Erik Stel <erik.stel(a)gmail.com> wrote:
>
> Hi Sven,
>
> (I hope this message does arrive. Sorry for the late reply. I have not been able to use the browser-interface for the ML for a number of days now. An admin could not figure this out either. So resorting to actually using a mail ;-)
>
> My architecture is one in which client and server are working fairly independent. A client or server can send the other a message whenever it wants (and there is no response expected). The client is responsible for setting up the connection and keeping it âopenâ (for the server to reach the client). When the client wants it can however disconnect and reconnect at a later time. The server will still be there (this is not visible in the example of course). Both client and server keep track of messages which canât be sent when the connection is (temporarily) down.
>
> So I have to have a separate process to read messages from the process that writes messages to the WebSocket. In a test I discovered that closing the connection from the client did not get noticed in the process doing the reading. Iâd like that process to stop running fairly directly since it is performing some additional logic. Now it takes a timeout. Closing the connection using the specified workaround does get noticed and works for me. But Iâm unsure if this is a good approach and thereâs the risk it will not work on a next update. A shorter timeout could be a solution but does mean Iâm going into a âpollingâ mode. So I think I prefer my workaround over setting a very short timeout.
>
> If you have a better solution though, please let me know.
>
> Kind regards,
> Erik
>
>
June 5, 2020
Re: [Pharo-users] shape file reading
by Thierry Goubier
Hi Hans,
Roassal has support for loading OSM raw data and OSM tiles (map
backgrounds) (WGS84 projection). See
https://www.youtube.com/watch?v=6zoGIsQaGUo&t=429s. We've also
experimented with animations as well:
https://www.youtube.com/watch?v=sMB7DG-lbiU; we've also tried in the
past to work out of GRASS-produced rasters for complex geographic
analysis, such as runoff flooding, projected on osm tiles.
Regards,
Thierry
Le ven. 5 juin 2020 à 14:27, Baveco, Hans <hans.baveco(a)wur.nl> a écrit :
>
> Well, it appears that simple direct downloading does not download the real shapefile. Taking care to actually get a shapefile, the result loads without problems.
>
> ne_110m_populated_places.shp is a PointShape with 243 shapes (points). If you display it on a Form (#displayMorphic) you wonât see much (243 hardly visible dots).
>
>
>
> With an application for vector graphics (Roassal?) that can read & display the vector data we would get much nicer maps...
>
>
>
> Hans
>
>
>
> From: Baveco, Hans <hans.baveco(a)wur.nl>
> Sent: vrijdag 5 juni 2020 12:44
> To: Any question about pharo is welcome <pharo-users(a)lists.pharo.org>
> Subject: [Pharo-users] shape file reading
>
>
>
> 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
>
>
>
>
June 5, 2020
Re: [Pharo-users] shape file reading
by Baveco, Hans
Well, it appears that simple direct downloading does not download the real shapefile. Taking care to actually get a shapefile, the result loads without problems.
ne_110m_populated_places.shp is a PointShape with 243 shapes (points). If you display it on a Form (#displayMorphic) you wonât see much (243 hardly visible dots).
With an application for vector graphics (Roassal?) that can read & display the vector data we would get much nicer maps...
Hans
From: Baveco, Hans <hans.baveco(a)wur.nl>
Sent: vrijdag 5 juni 2020 12:44
To: Any question about pharo is welcome <pharo-users(a)lists.pharo.org>
Subject: [Pharo-users] shape file reading
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
June 5, 2020
Re: [Pharo-users] GIS support for Pharo
by serge.stinckwich@gmail.com
Yes sure. We will see how we integrate it to a bigger software.
A+
Sent from my iPhone
> On 5 Jun 2020, at 19:49, Stéphane Ducasse <stephane.ducasse(a)inria.fr> wrote:
>
> Cool can you fork my ESRI repo. I want to keep it for exercises in the future.
> Or I can push it to this organisation and clone it for myself.
>
> S.
>
>> On 5 Jun 2020, at 13:09, Serge Stinckwich <serge.stinckwich(a)gmail.com> wrote:
>>
>> I create a pharo-GIS organization here:
>>
>> https://github.com/pharo-GIS
>>
>>> On Fri, Jun 5, 2020 at 5:35 PM Norbert Hartl <norbert(a)hartl.name> wrote:
>>> Wel, thatâs what I proposed. So yes from me
>>>
>>>>> Am 05.06.2020 um 10:03 schrieb Stéphane Ducasse <stephane.ducasse(a)inria.fr>:
>>>>>
>>>> Serge I was thinking that it would be good to create pharo-gis organisation.
>>>> What do you and the others think?
>>>>
>>>> S
>>>>
>>>>> On 5 Jun 2020, at 03:46, Serge Stinckwich <serge.stinckwich(a)gmail.com> wrote:
>>>>>
>>>>> Hi Todd,
>>>>>
>>>>> you can join. Everyone is welcome.
>>>>> GDAL FFI integration would be great, but this is a lot of work I guess.
>>>>>
>>>>> Regards,
>>>>>
>>>>>> On Fri, Jun 5, 2020 at 2:34 AM Todd Blanchard via Pharo-users <pharo-users(a)lists.pharo.org> wrote:
>>>>>> Hi Serge,
>>>>>>
>>>>>> I would love to participate in getting some GIS features into Pharo. I think it would be a fantastic platform for GIS.
>>>>>>
>>>>>> My personal orientation is doing marine navigation (have boat with sensors, want boat to be be smarter about navigation).
>>>>>>
>>>>>> My main interests is in being able to render S57/S52 formats. There are a number of boat fans that balk at the price of expensive chart plotter computers and software.
>>>>>>
>>>>>> They have given rise to some DIY stuff. Some of it just rips code straight out of https://gdal.org - I think possibly a FFI integration with gdal might be an amazing resource.
>>>>>>
>>>>>> I am time constrained for when I can work on this stuff but would like it a lot if we at least had some core data types for simple things like lat/lng, regions (polygons), and a decent general map renderer.
>>>>>>
>>>>>> Anyhow, please include me in any conversations. Navigation (both air and sea) are two things I have an interest in.
>>>>>>
>>>>>>> On Jun 3, 2020, at 8:31 PM, Serge Stinckwich <serge.stinckwich(a)gmail.com> wrote:
>>>>>>>
>>>>>>> Dear all,
>>>>>>>
>>>>>>> there was already some discussion in the list about GIS support for Pharo previously.
>>>>>>>
>>>>>>> Working on CORMAS multi-agent simulation platform: https://github.com/cormas/cormas some developers feel the need to have more GIS support for Pharo.
>>>>>>>
>>>>>>> I know of existing GIS software:
>>>>>>> - GeoJSON by Zweidenker: https://github.com/zweidenker/GeoJSON
>>>>>>> - ESRI ascii raster, done by Stephane recently: https://github.com/Ducasse/ESRI-ASCII-Raster
>>>>>>> - shapefile support by Hernan: http://smalltalkhub.com/#!/~hernan/Shapes
>>>>>>> (to be moved to github)
>>>>>>> - I found this project also: http://www.squeaksource.com/gekon.html
>>>>>>>
>>>>>>> I know that Etienne Delay is also interested by GIS support and propose to implement OpenGIS model support: https://github.com/cormas/cormas/issues/139
>>>>>>>
>>>>>>> Can we try to unite and maybe create a pharo-GIS organization on github to federate our efforts?
>>>>>>>
>>>>>>> Cheers,
>>>>>>> --
>>>>>>> Serge Stinckwich
>>>>>>> https://twitter.com/SergeStinckwich
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Serge Stinckwicâhâ
>>>>> https://twitter.com/SergeStinckwich
>>>>> â
>>>>
>>>> --------------------------------------------
>>>> Stéphane Ducasse
>>>> http://stephane.ducasse.free.fr / http://www.pharo.org
>>>> 03 59 35 87 52
>>>> Assistant: Aurore Dalle
>>>> FAX 03 59 57 78 50
>>>> TEL 03 59 35 86 16
>>>> S. Ducasse - Inria
>>>> 40, avenue Halley,
>>>> Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
>>>> Villeneuve d'Ascq 59650
>>>> France
>>>>
>>
>>
>> --
>> Serge Stinckwicâhâ
>> https://twitter.com/SergeStinckwich
>> â
>
> --------------------------------------------
> Stéphane Ducasse
> http://stephane.ducasse.free.fr / http://www.pharo.org
> 03 59 35 87 52
> Assistant: Aurore Dalle
> FAX 03 59 57 78 50
> TEL 03 59 35 86 16
> S. Ducasse - Inria
> 40, avenue Halley,
> Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
> Villeneuve d'Ascq 59650
> France
>
June 5, 2020
Re: [Pharo-users] GIS support for Pharo
by Stéphane Ducasse
Cool can you fork my ESRI repo. I want to keep it for exercises in the future.
Or I can push it to this organisation and clone it for myself.
S.
> On 5 Jun 2020, at 13:09, Serge Stinckwich <serge.stinckwich(a)gmail.com> wrote:
>
> I create a pharo-GIS organization here:
>
> https://github.com/pharo-GIS <https://github.com/pharo-GIS>
> On Fri, Jun 5, 2020 at 5:35 PM Norbert Hartl <norbert(a)hartl.name <mailto:norbert@hartl.name>> wrote:
> Wel, thatâs what I proposed. So yes from me
>
>> Am 05.06.2020 um 10:03 schrieb Stéphane Ducasse <stephane.ducasse(a)inria.fr <mailto:stephane.ducasse@inria.fr>>:
>>
>> Serge I was thinking that it would be good to create pharo-gis organisation.
>> What do you and the others think?
>>
>> S
>>
>>> On 5 Jun 2020, at 03:46, Serge Stinckwich <serge.stinckwich(a)gmail.com <mailto:serge.stinckwich@gmail.com>> wrote:
>>>
>>> Hi Todd,
>>>
>>> you can join. Everyone is welcome.
>>> GDAL FFI integration would be great, but this is a lot of work I guess.
>>>
>>> Regards,
>>>
>>> On Fri, Jun 5, 2020 at 2:34 AM Todd Blanchard via Pharo-users <pharo-users(a)lists.pharo.org <mailto:pharo-users@lists.pharo.org>> wrote:
>>> Hi Serge,
>>>
>>> I would love to participate in getting some GIS features into Pharo. I think it would be a fantastic platform for GIS.
>>>
>>> My personal orientation is doing marine navigation (have boat with sensors, want boat to be be smarter about navigation).
>>>
>>> My main interests is in being able to render S57/S52 formats. There are a number of boat fans that balk at the price of expensive chart plotter computers and software.
>>>
>>> They have given rise to some DIY stuff. Some of it just rips code straight out of https://gdal.org <https://gdal.org/> - I think possibly a FFI integration with gdal might be an amazing resource.
>>>
>>> I am time constrained for when I can work on this stuff but would like it a lot if we at least had some core data types for simple things like lat/lng, regions (polygons), and a decent general map renderer.
>>>
>>> Anyhow, please include me in any conversations. Navigation (both air and sea) are two things I have an interest in.
>>>
>>>> On Jun 3, 2020, at 8:31 PM, Serge Stinckwich <serge.stinckwich(a)gmail.com <mailto:serge.stinckwich@gmail.com>> wrote:
>>>>
>>>> Dear all,
>>>>
>>>> there was already some discussion in the list about GIS support for Pharo previously.
>>>>
>>>> Working on CORMAS multi-agent simulation platform: https://github.com/cormas/cormas <https://github.com/cormas/cormas> some developers feel the need to have more GIS support for Pharo.
>>>>
>>>> I know of existing GIS software:
>>>> - GeoJSON by Zweidenker: https://github.com/zweidenker/GeoJSON <https://github.com/zweidenker/GeoJSON>
>>>> - ESRI ascii raster, done by Stephane recently: https://github.com/Ducasse/ESRI-ASCII-Raster <https://github.com/Ducasse/ESRI-ASCII-Raster>
>>>> - shapefile support by Hernan: http://smalltalkhub.com/#!/~hernan/Shapes <http://smalltalkhub.com/#!/~hernan/Shapes>
>>>> (to be moved to github)
>>>> - I found this project also: http://www.squeaksource.com/gekon.html <http://www.squeaksource.com/gekon.html>
>>>>
>>>> I know that Etienne Delay is also interested by GIS support and propose to implement OpenGIS model support: https://github.com/cormas/cormas/issues/139 <https://github.com/cormas/cormas/issues/139>
>>>>
>>>> Can we try to unite and maybe create a pharo-GIS organization on github to federate our efforts?
>>>>
>>>> Cheers,
>>>> --
>>>> Serge Stinckwich
>>>> https://twitter.com/SergeStinckwich <https://twitter.com/SergeStinckwich>
>>>
>>>
>>>
>>> --
>>> Serge Stinckwicâhâ
>>> https://twitter.com/SergeStinckwich <https://twitter.com/SergeStinckwich>
>>> â
>>
>> --------------------------------------------
>> Stéphane Ducasse
>> http://stephane.ducasse.free.fr <http://stephane.ducasse.free.fr/> / http://www.pharo.org <http://www.pharo.org/>
>> 03 59 35 87 52
>> Assistant: Aurore Dalle
>> FAX 03 59 57 78 50
>> TEL 03 59 35 86 16
>> S. Ducasse - Inria
>> 40, avenue Halley,
>> Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
>> Villeneuve d'Ascq 59650
>> France
>>
>
>
> --
> Serge Stinckwicâhâ
> https://twitter.com/SergeStinckwich <https://twitter.com/SergeStinckwich>
> â
--------------------------------------------
Stéphane Ducasse
http://stephane.ducasse.free.fr / http://www.pharo.org
03 59 35 87 52
Assistant: Aurore Dalle
FAX 03 59 57 78 50
TEL 03 59 35 86 16
S. Ducasse - Inria
40, avenue Halley,
Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
Villeneuve d'Ascq 59650
France
June 5, 2020