Solved

Exported shapefile problems - FeatureWriter


Hi,

So after lots of testing, it's looks like when I export shapefiles using the FeatureWriter and include the .sbn Spatial Index, the shapefiles do not function properly. When first loading them in ArcMap, they appear to be ok, but when zooming, selecting, panning the map, I get very odd results with certain features suddenly dissapearing, not being selectable, etc.

 

If I modify my FeatureWriter to not include any spatial index, then the shapefiles work fine. I only have this problem when I include the spatial index.

 

I would like to include the spatial index. Is there a fix for this??

 

Thanks,

icon

Best answer by debbiatsafe 8 August 2020, 01:52

View original

17 replies

Badge +22

I do know the opposite problem, shapefiles with spatial indexes were not being read correctly when a bounding box or search envelope was used, was fixed in the 2020.0.3 release.

I do know the opposite problem, shapefiles with spatial indexes were not being read correctly when a bounding box or search envelope was used, was fixed in the 2020.0.3 release.

Hi @jdh,

I can confirm that I am using 2020.0.3, and when I 'draw a box' around features in the shapefile they DO NOT get selected properly.

Also when zooming in, features randomly dissapear.

 

Badge +22

Hi @jdh,

I can confirm that I am using 2020.0.3, and when I 'draw a box' around features in the shapefile they DO NOT get selected properly.

Also when zooming in, features randomly dissapear.

 

That absolutely sounds like a corrupt spatial index. I suggest you file a bug report with SAFE. I would give them your workspace, and two samples outputs, one with the spatial indexes created in FME, and one where they are created in arcmap (ie no index of the featureWriter, but use the Add Spatial Index tool in arcmap).

That absolutely sounds like a corrupt spatial index. I suggest you file a bug report with SAFE. I would give them your workspace, and two samples outputs, one with the spatial indexes created in FME, and one where they are created in arcmap (ie no index of the featureWriter, but use the Add Spatial Index tool in arcmap).

Thanks @jdh,

Where do I go to open a bug report?

Also, in the meantime what can be done. Is there an alternative to creating shapefiles, other than the FeatureWriter? I thought using FME to replace a process already created in esri Model Builder would be a good idea, but I've spent so much time on trying to resolve glichy little things I'm losing confidence that this was the right decision.

 

Badge +2

Thanks @jdh,

Where do I go to open a bug report?

Also, in the meantime what can be done. Is there an alternative to creating shapefiles, other than the FeatureWriter? I thought using FME to replace a process already created in esri Model Builder would be a good idea, but I've spent so much time on trying to resolve glichy little things I'm losing confidence that this was the right decision.

 

@bbulla you can file an issue at through https://www.safe.com/support/report-a-problem/

Badge +22

Thanks @jdh,

Where do I go to open a bug report?

Also, in the meantime what can be done. Is there an alternative to creating shapefiles, other than the FeatureWriter? I thought using FME to replace a process already created in esri Model Builder would be a good idea, but I've spent so much time on trying to resolve glichy little things I'm losing confidence that this was the right decision.

 

To report a bug you can fill out the following form https://www.safe.com/support/report-a-problem/

 

As for your current process, How important is is to have a spatial index? Ie how much time savings are you seeing further down the process. Everything will work without one.

If they are vital, until the bug gets fixed, you could potentially use python to run the arcmap tool.

To report a bug you can fill out the following form https://www.safe.com/support/report-a-problem/

 

As for your current process, How important is is to have a spatial index? Ie how much time savings are you seeing further down the process. Everything will work without one.

If they are vital, until the bug gets fixed, you could potentially use python to run the arcmap tool.

Yes, I could get by without using the index file. Unfortunately in our current process, the tablets that these shapefiles will eventually go on, get put onto them through a copy/paste process. So if I do not have new spatial index files, then the existing index files will get mixed it with the new shapefiles and that will cause big problems.

Also, there are more than just shapefiles in the folder that these shapefiles will go to, so to make sure to remember to go though all the files and delete only the existing spatial index files is not really that practical. If we even miss one file in this step on one of the 80+ field tablets, it will cause lots of grief.

The best solution is to just have the spatial index files work properly to facilitate an easy, no brainer, copy/paste process that is already existing.

 

 

Badge +22

In which case I suggest, that until the bug is resolved, use a shutdown script to call arcpy and generate the spatial indexes as a post process.

Badge +22

Yes, I could get by without using the index file. Unfortunately in our current process, the tablets that these shapefiles will eventually go on, get put onto them through a copy/paste process. So if I do not have new spatial index files, then the existing index files will get mixed it with the new shapefiles and that will cause big problems.

Also, there are more than just shapefiles in the folder that these shapefiles will go to, so to make sure to remember to go though all the files and delete only the existing spatial index files is not really that practical. If we even miss one file in this step on one of the 80+ field tablets, it will cause lots of grief.

The best solution is to just have the spatial index files work properly to facilitate an easy, no brainer, copy/paste process that is already existing.

 

 

In which case I suggest, that until the bug is resolved, use a shutdown script to call arcpy and generate the spatial indexes as a post process.

In which case I suggest, that until the bug is resolved, use a shutdown script to call arcpy and generate the spatial indexes as a post process.

Thanks @jdh,

I'll have to investigate. I'm not well schooled in python. Can you point me to some online samples on how to do this??

Badge +22

Thanks @jdh,

I'll have to investigate. I'm not well schooled in python. Can you point me to some online samples on how to do this??

There's some example code at https://desktop.arcgis.com/en/arcmap/10.3/tools/data-management-toolbox/add-spatial-index.htm

I've never used that particular tool, but presumably your in features would be the shapefile, you don't need the sde connection, and the spatial grid should be 0.

 

 

In FME make sure the python compatibility is set to ArcGIS Desktop or ArcGIS Pro, as appropriate.

There's some example code at https://desktop.arcgis.com/en/arcmap/10.3/tools/data-management-toolbox/add-spatial-index.htm

I've never used that particular tool, but presumably your in features would be the shapefile, you don't need the sde connection, and the spatial grid should be 0.

 

 

In FME make sure the python compatibility is set to ArcGIS Desktop or ArcGIS Pro, as appropriate.

Awesome! Thanks @jdh. That was super easy!

Do you know if there is a way to incorporate the User Parameter I have for the folder into the python code?? This parameter gets set when the workflow starts. That way I can get out of hard coding it and having to constantly change it.

Badge +22

Awesome! Thanks @jdh. That was super easy!

Do you know if there is a way to incorporate the User Parameter I have for the folder into the python code?? This parameter gets set when the workflow starts. That way I can get out of hard coding it and having to constantly change it.

You can access user parameters via the fme.macroValues dictionary.

https://knowledge.safe.com/articles/706/python-and-fme-basics.html

You can access user parameters via the fme.macroValues dictionary.

https://knowledge.safe.com/articles/706/python-and-fme-basics.html

Great. Thanks for all your help @jdh. Things are working well now.

Userlevel 1
Badge +21

Did this get raised as an issue?

Did this get raised as an issue?

Yes, FME knows it is an issue. They contacted me and were able to replicate the problem. For now, the shutdown script seems to be the best workaround.

Userlevel 3
Badge +17

This issue has been fixed in 2020.2 betas. Shapefiles with a .sbn spatial index should display correctly in ArcMap at various zoom levels.

Reply