Can't open shape file

View: New views
2 Messages — Rating Filter:   Alert me  

Can't open shape file

by indiga :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Another shape file is open but my shape file was convert from .tab file(mapinfo) with fwtolls.
In my file i have street of my city.
This is my code:


import java.awt.event.*;
import java.util.Properties;
import javax.swing.JFrame;

import com.bbn.openmap.*;

import com.bbn.openmap.layer.shape.ShapeLayer;


public class OpenMap extends JFrame {
   
    public OpenMap(String name)
    {
        super(name); // set title

       
        setSize(640, 480); // and location
       
        // Create a map handler (map, layer, component container)
        MapHandler mapHandler = new MapHandler();
       
        // Create a MapBean
        MapBean mapBean = new MapBean();
        mapHandler.add(mapBean);
       
       // mapBean.setScale(10000000f);
     // mapBean.setCenter(new LatLonPoint(35.0f, -800.0f));

     
        ShapeLayer shapeLayer = new ShapeLayer() ;
       
     
        Properties shapeLayerProps = new Properties();
        //Properties shapeLayerProps1 = new Properties();
       
        shapeLayerProps.put("prettyName", "Political Solid");
        shapeLayerProps.put("lineColor", "045000");
        shapeLayerProps.put("fillColor", "BD4E83");
       
     
           shapeLayerProps.put("shapeFile", "data/shape/city.shp");
       
     
        shapeLayer.setProperties(shapeLayerProps);
       mapBean.add(shapeLayer);
           
   
        getContentPane().add(mapBean);
       
    }
   
    public static void main(String[] argv) {
               
     
       
       OpenMap simpleMap = new OpenMap("Simple Map With Low-Level Mouse Events");
           
       simpleMap.addWindowListener(new WindowAdapter() {
           public void windowClosing(WindowEvent e) {
               System.exit(0);
           }});
           
            simpleMap.show();
    }
   
 
   
}
help please danke sir!!!!!!!!!

Re: Can't open shape file

by JayDub :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I think you need to also add the .ssx file.... for example
communities.shapeIndex=c:\\data\\communities_84.ssx

There's a class you can use to generate the ssx file.
com.bbn.openmap.layer.shape.ShapeIndex

Use it like so....
java -cp .;openmap.jar com.bbn.openmap.layer.shape.ShapeIndex shpfile.shp > output.ssx

Then add the shapeIndex to your openmap.properties file.


indiga wrote:
Another shape file is open but my shape file was convert from .tab file(mapinfo) with fwtolls.
In my file i have street of my city.
This is my code:


import java.awt.event.*;
import java.util.Properties;
import javax.swing.JFrame;

import com.bbn.openmap.*;

import com.bbn.openmap.layer.shape.ShapeLayer;


public class OpenMap extends JFrame {
   
    public OpenMap(String name)
    {
        super(name); // set title

       
        setSize(640, 480); // and location
       
        // Create a map handler (map, layer, component container)
        MapHandler mapHandler = new MapHandler();
       
        // Create a MapBean
        MapBean mapBean = new MapBean();
        mapHandler.add(mapBean);
       
       // mapBean.setScale(10000000f);
     // mapBean.setCenter(new LatLonPoint(35.0f, -800.0f));

     
        ShapeLayer shapeLayer = new ShapeLayer() ;
       
     
        Properties shapeLayerProps = new Properties();
        //Properties shapeLayerProps1 = new Properties();
       
        shapeLayerProps.put("prettyName", "Political Solid");
        shapeLayerProps.put("lineColor", "045000");
        shapeLayerProps.put("fillColor", "BD4E83");
       
     
           shapeLayerProps.put("shapeFile", "data/shape/city.shp");
       
     
        shapeLayer.setProperties(shapeLayerProps);
       mapBean.add(shapeLayer);
           
   
        getContentPane().add(mapBean);
       
    }
   
    public static void main(String[] argv) {
               
     
       
       OpenMap simpleMap = new OpenMap("Simple Map With Low-Level Mouse Events");
           
       simpleMap.addWindowListener(new WindowAdapter() {
           public void windowClosing(WindowEvent e) {
               System.exit(0);
           }});
           
            simpleMap.show();
    }
   
 
   
}
help please danke sir!!!!!!!!!