I don't have any experience working with Geoserver, and I have no experience developing inside the Geotools library. However, I wonder if it might not be easier for you to extend the DirectPosition2D class with your own implementation and then import that jar into Geoserver. Just a thought.
From: lv [mailto:lv.123@...]
Sent: Wednesday, November 10, 2010 4:08 AM
Subject: Re: [Geotools-gt2-users] How to offset GIS data
My customer requires all points of maps should be offset to a new place. To offset data, a JAR file which contains a algorithm is used.
x and y coordinate are passed to this JAR. New x and y coordinate will be created by it.
For each point, the offset for x and y is different. But for a point, the offset distance is the same.
For example, two points [point A (10, 20), point B (30, 40)] are passed to that JAR. After processing in the 1st time, point A (11, 23), point B (36, 45).
In the 2nd time, point A (11, 23), point B (36, 45).
A people told me that I can create views in Postgis. Another people recommended me to use SLD. They are good methods. But I cannot get the algorithm and I don't know the offset distance for each point. Original GIS data may be stored in PostGIS, Oracle, or just shape files. Therefore, I have to add this JAR to Geoserver or Geotools projects and pass coordinate of each point to get new coordinates.
In GeoTools project, I change DirectPosition2D.java as follow
public DirectPosition2D(final CoordinateReferenceSystem crs,
final double x, final double y)
super(x+100000000,y+200000000); //added by YE
(Above modification is just a test. I will add jar file later. )
Then, the map created from shape files are offset. I test this using Quickstart.java. After testing, I rebuild Geotools using maven [mvn -DskipTests clean install]. The build is successful.
After that, I copy all libraries of GeoTool [D:\GeoTool_win2008_32\trunk\target\binaries] to Geoserver source code
Then, I rebuild Geoserver. However, the coordinate is not changed.
> Date: Wed, 10 Nov 2010 18:42:55 +1100
> Subject: Re: [Geotools-gt2-users] How to offset GIS data
> From: michael.bedward@...
> To: lv.123@...
> CC: geotools-gt2-users@...
> I'm not sure why you want to modify GeoServer or GeoTools source code
> to move some data points around ? This is something that you would do
> in your own code.
> However, I probably don't understand your question properly. It's not
> really clear what you mean by...
> "This JAR file can create random data. I should get these random data
> and offset the correct GIS data"
> Perhaps if you could provide a clearer explanation people here will be
> able to help you.
> 2010/11/2 lv <lv.123@...>:
> > Hi,
> > I am new in GIS and GeoTool. My question is about how to change the
> > Geoserver's source code.
> > I should send this email to Geoserver's mailing list but nobody can tell me
> > how to modify Geoserver's source code at Geoserver's mailing-list. I have
> > waited for more than 2 weeks.
> > What I need is offsetting the GIS data after getting data from source
> > (database or others) and before publishing map. The reason why I cannot use
> > SLD is that my boss gave me a jar file and I should use this JAR file to
> > offset data. My boss does not want to use SLD. This JAR file can create
> > random data. I should get these random data and offset the correct GIS data.
> > In each layer, ever point should be moved to different place. For example,
> > 30% points should be moved to North 100 meters. 30% points should be moved
> > to south 20 meters. The rest points should be moved to east 300 meters.
> > Should I change the Geoserver's source code or the jar file of GeoTool at
> > Geoserver?
> > Which part of code should I modify if I should change the jar files of
> > GeoTool?
> > Thanks a lot.
> > ------------------------------------------------------------------------------
> > Nokia and AT&T present the 2010 Calling All Innovators-North America contest
> > Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
> > $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
> > Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
> > http://p.sf.net/sfu/nokia-dev2dev
> > _______________________________________________
> > Geotools-gt2-users mailing list
> > Geotools-gt2-users@...
> > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users