1

I'm used the GDAL to modify the coordinates of polygons. I have referenced the C++ and Python versions of the code and modified them in Java:

    String ShpPath="G:\\GeoData\\New_Shapefile.shp";
    DataSource dataSource=ogr.Open(ShpPath,1);
    Layer layer=dataSource.GetLayer(0);
    System.out.println(layer.GetFeatureCount());
    Feature feature;


    while ((feature=layer.GetNextFeature())!=null)
    {
        Geometry geometry = feature.GetGeometryRef();

        Geometry geo2=geometry.GetGeometryRef(0);

        for (int j = 0; j < geo2.GetPointCount(); j++)
        {
            System.out.println("X:"+geo2.GetX(j)+" Y:"+geo2.GetY(j));
            geo2.SetPoint(j,geo2.GetX(j)+1,geo2.GetY(j)+1);
        }
        feature.SetGeometry(geometry);
        layer.SetFeature(feature);

    }

But when I'm done, I load the data into Arcmap and a warning is displayed: Acope inconsistent! The scope of one or more added layers is inconsistent with the associated spatial reference information. How can I solve this problem?

1
  • 1
    Reference Systems have boundaries, for example -180.00, -90.00, 180.00, 90.00. Is it possible your code altered coordinates beyond the boundaries of your crs? Jun 11 at 2:57

0

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.