how to make the geojson format in java

0

I have a question, how would this format in java with hibernate and mysql?

{
  type: 'FeatureCollection',
  features: [{
    type: 'Feature',
    geometry: {
      type: 'Point',
      coordinates: [-77.032, 38.913]
    },
    properties: {
      title: 'Mapbox',
      description: 'Washington, D.C.'
    }
  },
  {
    type: 'Feature',
    geometry: {
      type: 'Point',
      coordinates: [-122.414, 37.776]
    },
    properties: {
      title: 'Mapbox',
      description: 'San Francisco, California'
    }
  }]
}
    
asked by Sebastian Cordova 17.04.2018 в 22:11
source

1 answer

0

I hope this helps you:

public class Geometry
{
  private String type;

  public String getType() { return this.type; }

  public void setType(String type) { this.type = type; }

  private ArrayList<double> coordinates;

  public ArrayList<double> getCoordinates() { return this.coordinates; }

  public void setCoordinates(ArrayList<double> coordinates) { this.coordinates = coordinates; }
}

public class Properties
{
  private String title;

  public String getTitle() { return this.title; }

  public void setTitle(String title) { this.title = title; }

  private String description;

  public String getDescription() { return this.description; }

  public void setDescription(String description) { this.description = description; }
}

public class Feature
{
  private String type;

  public String getType() { return this.type; }

  public void setType(String type) { this.type = type; }

  private Geometry geometry;

  public Geometry getGeometry() { return this.geometry; }

  public void setGeometry(Geometry geometry) { this.geometry = geometry; }

  private Properties properties;

  public Properties getProperties() { return this.properties; }

  public void setProperties(Properties properties) { this.properties = properties; }
}

public class RootObject
{
  private String type;

  public String getType() { return this.type; }

  public void setType(String type) { this.type = type; }

  private ArrayList<Feature> features;

  public ArrayList<Feature> getFeatures() { return this.features; }

  public void setFeatures(ArrayList<Feature> features) { this.features = features; }
}

That is already translatable to hibernate.

    
answered by 19.04.2018 / 18:14
source