NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Andrea, > > > In the code below I read the image and gain a flatField, which is > > > already read in the wrong position (the imageposition 0-2000,0-2000). > > > I do a resampling which obviously does not what I need, but I assume it > > > is there that something should happen. > > > > > > Set domainSet2 = new Linear2DSet(domain, 1632840.5, 1634840.5, > > > (int) (1634840.5 - 1632840.5), 5097079.5, 5099079.5, > > > (int) (5099079.5 - 5097079.5)); > > > imageField.resample(domainSet2); > > > > This should be: > > > > imageField = imageField.resample(domainSet2); > > > > Because the domain RealTupleType for imageField comes > > from DefaultFamily.open(), it will be easier to > > resample demField to domainSet2 than to resample > > imageField to the domain Set of demField. To do this, > > construct domainTuple (for demField) using: > > > > RealTupleType domainTuple > > new RealTupleType(easting, northing, coord_sys, null); > > > > where coord_sys is an instance of your new CoordinateSystem > > extension class that defines the mappings of > > (easting, northing) to and from the reference (x, y) > > (the coordinates of imageField). > > I still miss something. > The dem is in the right coordinate system, whereas the image is not > referenced in the geographic space. So I would expect to do the inverse > of what you are telling me, since I want to map the image into the dem > space and not the dem space into the image that is placed in the origin > of its system. The CoordinateSystem (CS) maps in both "to" and "from" directions, so in theory this should not matter. However, there is a problem in VisAD: you cannot display data defined in the reference (x, y) coordinates in a Display defined by ScalarMaps of the (easting, northing) coordinates. If your CS has reference coordinates (x, y) and you want to display data defined in (x, y), then your ScalarMaps must be defined in terms of x and y. If you cannot define your Display in terms of ScalarMaps of x and y, then you will need to extract the numerical arrays from imageField (read by the DefaultFamily.open() method) and use them to construct a new Field defined in terms of a new RealTupleType (xnew, ynew) with a CS with reference (easting, northing). > I try explain better throught some code how I tried to follow you > suggestions: You failed to follow my suggestion because your GeoToImageCoordinateSystem iCord has reference (RealType.XAxis, RealType.YAxis) (which should not be confused with Display.XAxis and Display.YAxis), but then RealType.XAxis and RealType.YAxis have no relation to x and y, the domain coordinates of imageField. Because of this lack of a relation, the system has no information about how to combine imageField with domain (x, y) and demField with domain (easting, northing). Also, the statement: Field newDemfield = demField.resample(imageDomainSet); is unnecessary. This operation will be implicit in FieldImpl.combine() if there is a CS that defines a relation between (x, y) and (easting, northing). Good luck, Bill ============================================================================== To unsubscribe visad, visit: http://www.unidata.ucar.edu/mailing-list-delete-form.html ==============================================================================
visad
archives: