Embedding/extending the geoscript console

4 views
Skip to first unread message

moovida

unread,
Jan 30, 2018, 9:56:40 AM1/30/18
to GeoScript
HI all, 
I am trying to figure out how to add libraries to the geoscript console. 
While I thought it would be really simple, I am bumping against a problem I do not understand.

To start I created a small maven project with geoscript and my libraries as dependencies.
I then create a groovy Console as explained for example here: http://groovy-lang.org/groovyconsole.html#GroovyConsole-EmbeddingtheConsole

I am then able to run a script like:

import org.hortonmachine.modules.*;
new Pitfiller().template();

which is a class in the classpath of the project.

But if I try to run:

import geoscript.geom.Point

def point = new Point(0,0)
def poly = point.buffer(10)
println(poly.wkt)


I get an error complaining about:

groovy.lang.MissingPropertyException: No such property: wkt for class: geoscript.geom.Polygon


I am a bit puzzeled, since in the referenced libraries of the project geoscript also appears.

Any idea what I could be doing wrong?

Thank you,
Best regards,
Andrea



PS: on a sidenote, in the pom I had to add an exclusion:
<exclusions>
<exclusion>
<groupId>no.ecc.vectortile</groupId>
<artifactId>java-vector-tile</artifactId>
</exclusion>
</exclusions>

since it could not find the jar in the repo. Does this come from a different one? In maven central there is a last 1.0.9 version, while the project seems to require 1.1.2.

scott bortman

unread,
Jan 30, 2018, 10:08:00 AM1/30/18
to geos...@googlegroups.com
Hello Andrea,

Could you use Groovy's Grab feature?


--scottie

--
--
You received this message because you are subscribed to the GeoScript mailing list.
To post to this group, send email to geos...@googlegroups.com
To unsubscribe from this group, send email to geoscript+unsubscribe@googlegroups.com
Visit this group at http://groups.google.com/group/geoscript or see http://geoscript.org

---
You received this message because you are subscribed to the Google Groups "GeoScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geoscript+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jared Erickson

unread,
Jan 30, 2018, 8:42:18 PM1/30/18
to GeoScript Google Group
That is a strange error.  If the geoscript groovy jar is on the classpath your script should work.  That said, I have never tried embedding the console in another swing app.  I always use the regular groovy console.

The java-vector-tile library has its own repo:

<repository>
   <id>ecc</id>
   <name>ECC Repository</name>
   <url>https://github.com/ElectronicChartCentre/ecc-mvn-repo/raw/master/releases</url>
</repository>

I actually replaced this library with another in master.  

Jared

andrea antonello

unread,
Jan 30, 2018, 10:27:56 PM1/30/18
to geos...@googlegroups.com
Hi Scott,
thanks for the reply.

> Could you use Groovy's Grab feature?
>
> http://docs.groovy-lang.org/latest/html/documentation/grape.html

this is a cool feature I didn't know off.

My problem is a bit different though. I think with my configuration
everything should be in the classpath, but for some reason it doesn't.

Thanks,
Andrea
>> geoscript+...@googlegroups.com
>> Visit this group at http://groups.google.com/group/geoscript or see
>> http://geoscript.org
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "GeoScript" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to geoscript+...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> --
> You received this message because you are subscribed to the GeoScript
> mailing list.
> To post to this group, send email to geos...@googlegroups.com
> To unsubscribe from this group, send email to
> geoscript+...@googlegroups.com
> Visit this group at http://groups.google.com/group/geoscript or see
> http://geoscript.org
>
> ---
> You received this message because you are subscribed to the Google Groups
> "GeoScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geoscript+...@googlegroups.com.

andrea antonello

unread,
Jan 30, 2018, 10:31:00 PM1/30/18
to geos...@googlegroups.com
Hi Jared,

> That is a strange error. If the geoscript groovy jar is on the classpath
> your script should work. That said, I have never tried embedding the
> console in another swing app. I always use the regular groovy console.

yes, I also would define this error strange. It comes unexpected.
Maybe there is something I am not seeing. Will go over it again.

> The java-vector-tile library has its own repo:
>
> <repository>
> <id>ecc</id>
> <name>ECC Repository</name>
>
> <url>https://github.com/ElectronicChartCentre/ecc-mvn-repo/raw/master/releases</url>
> </repository>
>
> I actually replaced this library with another in master.

Great, thanks.

Andrea
>>> geoscript+...@googlegroups.com
>>> Visit this group at http://groups.google.com/group/geoscript or see
>>> http://geoscript.org
>>>
>>> ---
>>> You received this message because you are subscribed to the Google Groups
>>> "GeoScript" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to geoscript+...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> --
>> --
>> You received this message because you are subscribed to the GeoScript
>> mailing list.
>> To post to this group, send email to geos...@googlegroups.com
>> To unsubscribe from this group, send email to
>> geoscript+...@googlegroups.com
>> Visit this group at http://groups.google.com/group/geoscript or see
>> http://geoscript.org
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "GeoScript" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to geoscript+...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> --
> You received this message because you are subscribed to the GeoScript
> mailing list.
> To post to this group, send email to geos...@googlegroups.com
> To unsubscribe from this group, send email to
> geoscript+...@googlegroups.com
> Visit this group at http://groups.google.com/group/geoscript or see
> http://geoscript.org
>
> ---
> You received this message because you are subscribed to the Google Groups
> "GeoScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geoscript+...@googlegroups.com.

andrea antonello

unread,
Jan 31, 2018, 3:02:54 AM1/31/18
to geos...@googlegroups.com
A small update about this.

In my project I have a ton of geotools and other dependencies.
Creating standalone build I figured that there were many dependency
clashes.
I am finding clashes on libs like:
- jfreechart (gt has an old one, I think due to the license)
- groovy (and i think that was causing things to fail)

One strange that I find is gdal.jar. I do not have any dependency on
it, but geoscript make 3 jars come in:
gdal-1.11.2.1.jar
gdal-1.11.2.2.jar
gdal-1.11.2.jar

Do you have the same?

Anyways, I am cleaning up. And the base scripts already work now mixed
with the Hortonmachine project.

Thanks,
Andrea

scott bortman

unread,
Jan 31, 2018, 8:32:25 AM1/31/18
to geos...@googlegroups.com
Andrea,

It is hard to see what the problem might because we see only a little of 
your code and don't know the whole story about what your goal is.   If
you are using hortonworks,   you are probably doing some big data stuff?
Sounds interesting.   

Anyways,  the GDAL stuff is pulled in by a dependency on the raster processing stuff.   
If you don't need it,  you can probably just exclude it (or better yet,  the thing that included
it in the first place).   Looks like you are a Maven guy (personally I like Gradle).

Try using Maven's dependency tree command.

GeoTools can pull in everything but the kitchen sink sometimes.   Not sure why you are
getting multiple versions though.  I haven't had that experience.

Hope this helps a little,
--scottie






>>>> Visit this group at http://groups.google.com/group/geoscript or see
>>>> http://geoscript.org
>>>>
>>>> ---
>>>> You received this message because you are subscribed to the Google Groups
>>>> "GeoScript" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send an

>>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>>
>>> --
>>> --
>>> You received this message because you are subscribed to the GeoScript
>>> mailing list.
>>> To post to this group, send email to geos...@googlegroups.com
>>> To unsubscribe from this group, send email to

>>> Visit this group at http://groups.google.com/group/geoscript or see
>>> http://geoscript.org
>>>
>>> ---
>>> You received this message because you are subscribed to the Google Groups
>>> "GeoScript" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an

>>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> --
>> --
>> You received this message because you are subscribed to the GeoScript
>> mailing list.
>> To post to this group, send email to geos...@googlegroups.com
>> To unsubscribe from this group, send email to

>> Visit this group at http://groups.google.com/group/geoscript or see
>> http://geoscript.org
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "GeoScript" group.
>> To unsubscribe from this group and stop receiving emails from it, send an

>> For more options, visit https://groups.google.com/d/optout.

--
--
You received this message because you are subscribed to the GeoScript mailing list.
To post to this group, send email to geos...@googlegroups.com
To unsubscribe from this group, send email to geoscript+unsubscribe@googlegroups.com

Visit this group at http://groups.google.com/group/geoscript or see http://geoscript.org

---
You received this message because you are subscribed to the Google Groups "GeoScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geoscript+unsubscribe@googlegroups.com.

andrea antonello

unread,
Feb 20, 2018, 4:48:21 AM2/20/18
to geos...@googlegroups.com
Hi Scott,
sorry for the very late reply and thank you for answering in first place.

> It is hard to see what the problem might because we see only a little of
> your code and don't know the whole story about what your goal is. If
> you are using hortonworks, you are probably doing some big data stuff?
> Sounds interesting.

I am afraid not. I.e. it is interesting :-), but the Hortonmachine is a
library for Hydrologic and Geomorphologic processing, so not
hortonworks.

>
> Anyways, the GDAL stuff is pulled in by a dependency on the raster
> processing stuff.
> If you don't need it, you can probably just exclude it (or better yet, the
> thing that included
> it in the first place). Looks like you are a Maven guy (personally I like
> Gradle).
>
> Try using Maven's dependency tree command.

I did and I started to cherry-pick (not the git way) every bit. What I
found was a big mess in the dependencies.
It took me more than a while to finish the cleanup and indeed it was
due to some older libs that geotools was pulling in.

> GeoTools can pull in everything but the kitchen sink sometimes. Not sure
> why you are
> getting multiple versions though. I haven't had that experience.

And you are completely right :-)

> Hope this helps a little,

Thanks a ton Scott.

All the best,
Andrea
>> >>>> geoscript+...@googlegroups.com
>> >>>> Visit this group at http://groups.google.com/group/geoscript or see
>> >>>> http://geoscript.org
>> >>>>
>> >>>> ---
>> >>>> You received this message because you are subscribed to the Google
>> >>>> Groups
>> >>>> "GeoScript" group.
>> >>>> To unsubscribe from this group and stop receiving emails from it,
>> >>>> send an
>> >>>> email to geoscript+...@googlegroups.com.
>> >>>> For more options, visit https://groups.google.com/d/optout.
>> >>>
>> >>>
>> >>> --
>> >>> --
>> >>> You received this message because you are subscribed to the GeoScript
>> >>> mailing list.
>> >>> To post to this group, send email to geos...@googlegroups.com
>> >>> To unsubscribe from this group, send email to
>> >>> geoscript+...@googlegroups.com
>> >>> Visit this group at http://groups.google.com/group/geoscript or see
>> >>> http://geoscript.org
>> >>>
>> >>> ---
>> >>> You received this message because you are subscribed to the Google
>> >>> Groups
>> >>> "GeoScript" group.
>> >>> To unsubscribe from this group and stop receiving emails from it, send
>> >>> an
>> >>> email to geoscript+...@googlegroups.com.
>> >>> For more options, visit https://groups.google.com/d/optout.
>> >>
>> >>
>> >> --
>> >> --
>> >> You received this message because you are subscribed to the GeoScript
>> >> mailing list.
>> >> To post to this group, send email to geos...@googlegroups.com
>> >> To unsubscribe from this group, send email to
>> >> geoscript+...@googlegroups.com
>> >> Visit this group at http://groups.google.com/group/geoscript or see
>> >> http://geoscript.org
>> >>
>> >> ---
>> >> You received this message because you are subscribed to the Google
>> >> Groups
>> >> "GeoScript" group.
>> >> To unsubscribe from this group and stop receiving emails from it, send
>> >> an
>> >> email to geoscript+...@googlegroups.com.
>> >> For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> --
>> You received this message because you are subscribed to the GeoScript
>> mailing list.
>> To post to this group, send email to geos...@googlegroups.com
>> To unsubscribe from this group, send email to
>> geoscript+...@googlegroups.com
>> Visit this group at http://groups.google.com/group/geoscript or see
>> http://geoscript.org
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "GeoScript" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to geoscript+...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> --
> You received this message because you are subscribed to the GeoScript
> mailing list.
> To post to this group, send email to geos...@googlegroups.com
> To unsubscribe from this group, send email to
> geoscript+...@googlegroups.com
> Visit this group at http://groups.google.com/group/geoscript or see
> http://geoscript.org
>
> ---
> You received this message because you are subscribed to the Google Groups
> "GeoScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geoscript+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages