0

By default, GeoTools (20.2) tries to convert the graphic objects into shapefiles on the disk. We want to skip this step and have GeoTools keep the file contents in memory (and return it as a byte array or other memory object) so we can stream it elsewhere. We have security requirements that prevent us from accessing the filesystem so all operations must be done in memory. This lack of functionality could preclude us from using GeoTools if it cannot accomplish this.

It seems easy enough to do this using Java streams. using streams to write the data into any kind of memory or file buffer. I need to understand if this was (or why it was not) done as it appears to be a simple "design for but not with" convention at its simplest.

Is there a need to remain backward compatible with older versions of Java that don't support some of these functions and what is the hard limit on Java versions like Java 6?

6
  • 2
    By definition, a shapefile is a filesystem-based entity. You need to use a streamable format.
    – Vince
    Commented Apr 21, 2022 at 12:14
  • the limit is java8 - and the reason it isn't done is because shapefiles are only designed to be stored on disk. If you need in memory then use a FeatureCollection which is designed for that
    – Ian Turton
    Commented Apr 21, 2022 at 12:44
  • Welcome to Geographic Information Systems! This seems like an XY problem - could you describe what you are trying to do as well as what you have tried so far.
    – Ian Turton
    Commented Apr 21, 2022 at 12:45
  • For reasons that I cannot divulge, the design directed us to use ShapeFiles as a medium. A side-effect of this decision is that we cannot FTP/scp the files to the host system so we package the bytes into a packet and send it over the network. The issue then is, "why do we have to write the files to the disk?" If we have the contents in memory, then we can use them as-is OR dump it to an actual file. Seems the only option is dump it to a file? I was curious if there were settings or some other method to access the byte buffer before it was written to the filesystem and skip the filesystem step?
    – Dylan
    Commented Apr 22, 2022 at 13:09
  • You'll either need to write to disk or add functionality to the project. But best bet is not to use a shapefile, compressed geojson or gml would work much better in this situation
    – Ian Turton
    Commented Apr 22, 2022 at 14:03

1 Answer 1

0

You'll either need to write to disk or add functionality to the project. But best bet is not to use a shapefile, compressed geojson or gml would work much better in this situation

1
  • So I would need to, at a minimum, extend an existing class to add or change the functionality locally in my source, or to augment the codebase for the OpenDDS project to add the functionality that I'm looking for so others can use it if they choose. Thank you.
    – Dylan
    Commented May 4, 2022 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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