i want create a shape file,below is the code:

import java.io.File;
import java.io.IOException;
import java.util.Collections;
import java.util.Map;
import org.geotools.data.DataStore;
import org.geotools.data.FileDataStoreFactorySpi;
import org.geotools.data.shapefile.indexed.IndexedShapefileDataStoreFactory;

class ee {
    /** Creates a new instance of ee */
    public ee() {
    }

    public static void main(String[] args){
        Map map=null;
        FileDataStoreFactorySpi factory = new
IndexedShapefileDataStoreFactory();
        File file = new File("my.shp");

        try {
            map = Collections.singletonMap("url", file.toURL() );
        }
        catch(IOException e) {
            System.out.println(e);
        }

        try {
            DataStore myData = factory.createNewDataStore(map);
        }
        catch(IOException e) {
            System.out.println(e);
        }

        try {
            DataStore myData = factory.createNewDataStore(map);
        }
        catch(IOException e) {
            System.out.println(e);
        }

        System.out.println("Ok!");
    }
}

when i compile and run the code ,i got the error messge:
compile-single:
run-single:
java.io.IOException: Parameter shapefile url is required:url to a .shp file
java.io.IOException: Parameter shapefile url is required:url to a .shp file

what is the problem?

could somebody give me a complete example of create a shape file?

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to