Getting PixelPos

Hi, I am trying to get pixel position using this approach:

                vectorDataLayer = InsertFigureInteractorInterceptor.getActiveVectorDataLayer(currentView);
                if(geometry instanceof Point)
                    wktFeatureType  = PlainFeatureFactory.createDefaultFeatureType(DefaultGeographicCRS.WGS84);
                    newCollection = new ListFeatureCollection(wktFeatureType);
                    featureBuilder = new SimpleFeatureBuilder(wktFeatureType);
                    wktFeature = featureBuilder.buildFeature("ID" + Long.toHexString(currentFeatureId++));
                    GeoPos geopos       = new GeoPos(((Point) geometry).getX(), ((Point) geometry).getY());
                    GeoCoding geocoding = currentView.getProduct().getSceneGeoCoding();
                    PixelPos pixelpos   = geocoding.getPixelPos(geopos, new PixelPos());

Although, I am getting a NaN using geocoding.getPixelPos.
I am just trying to draw a rectangle from a given point in Lat/Long.

So, I am trying to draw this so called rectangle using #x pixels and #y pixels from this point.

Any further guidelines?
Thanks in advance.

Are you sure that the coordinates are within the scene bounds?

Maybe you just need to swap x and y when you create the new GeoPos.

It has worked, @marpet . Thank you once again