1

I am working with QGIS and Geoserver. I have created a shapefile with an attribute table containing 4 rows/features and around 15 columns/attributes.

I published this file to Geoserver as Shapefile as points under publish section. I can see the four points in OpenLayer preview but when I select GeoJson from the dropdown I don't get the attribute table data.

Instead this is what I get.

    {
  "type": "FeatureCollection",
  "totalFeatures": 4,
  "features": [
    {
      "type": "Feature",
      "id": "toilet_list_trial.1",
      "geometry": {
        "type": "Point",
        "coordinates": [
          72.840306,
          18.948056
        ]
      },
      "geometry_name": "the_geom",
      "properties": {}
    },
    {
      "type": "Feature",
      "id": "toilet_list_trial.2",
      "geometry": {
        "type": "Point",
        "coordinates": [
          72.834778,
          18.947611
        ]
      },
      "geometry_name": "the_geom",
      "properties": {}
    },
    {
      "type": "Feature",
      "id": "toilet_list_trial.3",
      "geometry": {
        "type": "Point",
        "coordinates": [
          72.834944,
          18.947861
        ]
      },
      "geometry_name": "the_geom",
      "properties": {}
    },
    {
      "type": "Feature",
      "id": "toilet_list_trial.4",
      "geometry": {
        "type": "Point",
        "coordinates": [
          72.835278,
          18.947306
        ]
      },
      "geometry_name": "the_geom",
      "properties": {}
    }
  ],
  "crs": {
    "type": "name",
    "properties": {
      "name": "urn:ogc:def:crs:EPSG::404000"
    }
  }
}

What am I missing here?

0

It's hard to say what might be going wrong, if I goto

http://localhost:8080/geoserver/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=topp:states&maxFeatures=50&outputFormat=application%2Fjson

I get back the GeoJSON including all the attributes for the features as expected.

The only oddity in your data that I can see is that it has no projection set (it should be epsg:4326) but I doubt that could affect the attributes.

  • I just checked the SRS value. Its EPSG:404000. Can that be the problem? I'll try with 4326 and give update. – Chandan Pednekar Jun 3 '18 at 6:27
  • I set epsg:4326 from geoserver. it still doesn't show the attribute data. Am I doing any mistake while saving the shapefile? I just right click on layer and save it as shapefile with epsg:4326. Anything else I need to do? – Chandan Pednekar Jun 3 '18 at 6:37
0

The problem was me not copying rest of the files apart from the .shp file to the folder from where I was uploading data.

Once I copied other four files with extensions viz., .prj, .qpj, .shx and .dbf the attribute data now shows as it should.

This is the link which made me realize my mistake

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.