In some cases, I have to use some classes of GeoTools library.

Most of class names are duplicated in org.geotools and org.opengis package. for example, StyleVisitor, Symbolizer, PointSymbolizer, etc.

I want to know which one of them I should use in my project in usual coding.


import org.geotools.styling.Graphic;
import org.geotools.styling.LineSymbolizer;
import org.geotools.styling.Mark;
import org.geotools.styling.PointSymbolizer;


import org.opengis.style.Graphic;
import org.opengis.style.LineSymbolizer;
import org.opengis.style.Mark;
import org.opengis.style.PointSymbolizer;

My code:

public class MyStylePainter extends StylePainter {

    private MyStylePainter(int width, int height) {
        super(width, height);


    public void setWidthAndHeight(PointSymbolizer pointS) {
        double d = 15;
        double size = size(pointS.getGraphic());
        double realSize = d * size;
        int width = (int) Math.round(realSize);

    protected static double size(Graphic graphic) {
      double size = 1;
      if (graphic.getSize() != null) {
          size = Filters.asDouble(graphic.getSize());
      if (size <= 0) {
          size = .2d;
      return size;

Do I use import#1 or import#2 ?


1 Answer 1


TLDR; in general use the org.geotools imports if you are working solely with GeoTools code.

As is documented in the OpenGIS FAQ GeoTools once upon a time had idealistic developers who thought the world would be a better place if the "Java GIS Tribe" could share code more easily. So they built a set of interfaces that people implementing various OGC and ISO specifications could use as a basis for their concrete implementations. In this way they hoped that interoperability would be enhanced and the world would be a sunnier and happier place :-)

Sadly this never really came to pass.

These days the main value of the org.opengis.* interfaces is that they represent a "clean" version of the standard and the corresponding org.geotools.* interface may well have been extended to include other useful methods that make the standard easier to use or more useful to the average developer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.