Good evening,
Please excuse me from the previous post, this is the first time for me as I
joined a mailing list.
I'm french so please forgive my poor English.
So i got a lot of problem with GeoTools. Actually I'm using GeoTools 2.7.4. I
work for nearly three weeks on this library and I only now understand GeoTools.
I have to make a software that allows me to load a shapefile DOT representative
of features. And
when I click on a feature, I have to change the color of the point and
draw a circle of 50km radius around and retrieve all feature in this
cercle.Ensuite I compare feature that was clicking at any other feature
of the circle and retrieve only those with a corresponding variable (where
"OSTRALHER" = '5 'AND mesureCount> '0').
The corresponding feature should also be colorful. Moreover, when click a table
(JTable) should appear. The JTable must contain one line of feature previously
recovered.
And finally, I have to do mathematical calculations and displays features of
the curves. But his is good, all part of the graph, I managed.
Moving to the small problem I encountered:
-----> I followed the tutorial for display and loading the shapefile. PERFECT =
D
------> I took a second tutorial (
http://www.opensourcejavaphp.net/java/geotools/org/geotools/demo/SelectionLab.java.html)
to select one feature at a click on the JMapPane. NOT PERFECT = / Let me
explain I have a compilation error in this online tutorial:
mapFrame = new JMapFrame (map);
Exception in thread "main" java.lang.NullPointerException
Has org.geotools.swing.JMapPane.setTransforms (JMapPane.java: 1114)
Has org.geotools.swing.JMapPane.doSetDisplayArea (JMapPane.java: 607)
Has org.geotools.swing.JMapPane.doSetMapContext (JMapPane.java: 505)
Has org.geotools.swing.JMapPane.setMapContext (JMapPane.java: 472)
Has org.geotools.swing.JMapFrame. <init> (JMapFrame.java: 172)
Has org.geotools.swing.JMapFrame. <init> (JMapFrame.java: 152)
Has SelectionLab.displayShapefile (SelectionLab.java: 117)
Has SelectionLab.main (SelectionLab.java: 94)
So, i can not do anithing else except using the toolbar.INFO Which give me a
JTextArea with all information about the feature.
---> I did not find how to create a circle of 50km with coordinates when i
cliked on the map
--->
I don"t really anderstand how rules and FIlter work ( i already don't
anderstand how to create a simple Filter wich say something like that
SimpleFeatureIterator iter2 = collection.getSchema().getDescriptors();
try{
while (iter2.hasNext()){
SimpleFeature feature = iter2.next();
int nbMesure = ((Integer) feature.getAttribute(21));
if ( nbMesure < 1 ) feature.paint(Color.blue);
if( nbMesure > 500 ) feature.paint(Color.black);
}
}
----->so, I try with a tutorial (MAGIC!) Using a
JTable: http://opensourcejavaphp.net/java/geotools/org/geotools / demo /
QueryLab.java.html
it work perfectly but i wanted to do something without the window Where You
must choose the file size and do things.
private void connect (DataStoreFactorySpi format) throws Exception {
String url = "C: \ \ Users \ \ ASUS U46S \ \ Desktop \ \ RNT
finoct_2011 Data \ \ measures \ \ monShape.shp";
JDataStoreWizard JDataStoreWizard wizard = new (url);
wizard.setFormat (format);
Map <String, Object> connectionParameters
wizard.getConnectionParameters = ();
dataStore DataStoreFinder.getDataStore = (connectionParameters);
if (dataStore == null) {
JOptionPane.showMessageDialog (null, "Could not connect - check
parameters");
}
/ *
int result = wizard.showModalDialog ();
if (result == JWizard.FINISH) {
Map <String, Object> connectionParameters
wizard.getConnectionParameters = ();
dataStore DataStoreFinder.getDataStore = (connectionParameters);
if (dataStore == null) {
JOptionPane.showMessageDialog (null, "Could not connect -
check parameters");
} * /
updateUI ();
}
Obviously i did not work and the "Could not connect - check parameters" I say
the datastore is empty ... aim
this problem is not really important, but better To Have Self-year
parameter and do not ask the user to put again the shapefile ...
If Someone want all my code (a real rough ...), i can send it by mail order on
the post its not pretty =/
Thanks! and sorry for my poor english ...
ptitdje ------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users