Arturo,
In Pharo itself, you could just do it yourself, like this:
T3GeoTools class>>#is: position inside: polygon
"T3GeoTools is: [email protected] inside: { [email protected].
[email protected]. [email protected]. [email protected]. [email protected].
[email protected] }"
"T3GeoTools is: [email protected] inside: { [email protected].
[email protected]. [email protected]. [email protected]. [email protected].
[email protected] }"
"Point in polygon - ray casting algorithm -
http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html"
| inside otherIndex |
inside := false.
otherIndex := polygon size.
polygon doWithIndex: [ :each :index | | other |
other := polygon at: otherIndex.
(((each y > position y) ~= (other y > position y))
and: [ position x < (((other x - each x) * (position y
- each y) / (other y - each y)) + each x) ])
ifTrue: [ inside := inside not ].
otherIndex := index ].
^ inside
Inside circle, rectangle etc are trivial.
Sven
> On 25 Jul 2015, at 01:19, Arturo Zambrano <[email protected]> wrote:
>
> Hi All,
> I would like to get some advice regarding which path I should take.
>
> Problem:
> Given a coordinate I want to know to which geographical object it belongs to.
>
> Path 1
> Using Glorp to make a query to a Postgis instance containing the
> boundaries of the geobjects
>
>
>
> Path 2
> Use the data form GADM data (according to this thread).
>
>
> I would avoid path 1 in order to avoid installation of postgi. From the
> thread mentioned above, I thing that it requires some development.
>
>
> Regarding Path 2, I don't see which framework or library should I use to
> import and query the data contained in the KMZ from GADM.
>
>
> Any advice is welcome.
>
> Best regards.
> Art
>
>