1

I'm working on a project where a custom binary data file contains latitude, longitude, and temperature data. I'm interested in creating a DataStoreFactory plugin to enable GeoServer to load this information, and then use its own layers capabilities to create a coverage raster image.

I've spent some time looking through tutorials and the GeoTools site, and fighting with some dead links. My progress so far has been to create an eclipse project with the following class:

package org.geotools.giops.plugin;

import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import org.geotools.data.AbstractDataStoreFactory;
import org.geotools.data.DataStore;
import org.geotools.data.DataStoreFinder;

public class MyCompanyDataStoreFactorySpi extends AbstractDataStoreFactory {

    private static DataStore dataStore_ = null;

    private synchronized static DataStore getDataStore() throws IOException
    {
        if ( dataStore_ == null )
        {
            File file = new File("example.shp");
            Map map = new HashMap();
            map.put( "url", file.toURL() );

            dataStore_ = DataStoreFinder.getDataStore( map );
        }

        return dataStore_;

    }

    public DataStore createDataStore(Map<String, Serializable> arg0)
            throws IOException {
        System.out.println("createDataStore: args:");
        for(String key : arg0.keySet())
            System.out.print("key=" + arg0.get(key).toString() + ", ");
        System.out.println("");

        return getDataStore();
    }

    public DataStore createNewDataStore(Map<String, Serializable> arg0)
            throws IOException {
        System.out.println("createNewDataStore - weird");
        return getDataStore();
    }

    public String getDescription() {
        return "MyCompany Formatted Data Store";
    }

    public Param[] getParametersInfo() {
        // let's not return null at this point in the game
        Param p[] = { new Param("doit"), new Param("hmm") };
        return p;
    }

}

I've also added a META-INF/services/MyCompanyDataStoreFactorySpi file:

org.geotools.giops.plugin.GIOPsDataStoreFactorySpi

My expectation is that I can jar this up together with the META-INF folder, and then drop it into the GeoServer's webapps/WEB-INF/lib folder and have it pick it up as a new type of data store.

Currently, I don't see any indication in the logs that the jar is being noticed, or looked at. Perhaps I need some of the UI modifying code? I don't really know. While my dataSource is a shapefile at this point, the end goal is to load lat/long/temp data and render a raster image.

I've noticed that DataSource GeoTools classes only reference feature data. I'm worried I'm going in the wrong direction here.

Do you have any tips on how I should be proceeding with getting my custom datastore visible in the GeoServer's admin pages?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.