Development for use SXF russian vector maps in java with support PostGIS and etc.
Library was designed according with documentation on SXF format of version 4 and SXF format of version 3. All documentation on Russian language.
Data on which are tested
Library based on Read/Write. On this moment supports:
- Read SXF
- Write SXF
Dependes:
- Java Topology Suite (JTS) - for create geometry and provide them out in WKT, WKB, EWKT formats.
- PROJ4J - for client side transform coordinates (only for sxf4j-utils).
mvn -U clean install
Using sxf4j as library:
int number = 3695;
File file = new File("src/test/resources/K37007.SXF");
SXFReader sxfReader = new SXFReader(file);
SXFRecord sxfRecord = sxfReader.getRecordByNumber(number);
// Native coordinates in map projection
Geometry geometry = sxfRecord.geometry();
sxfReader.close();
This tool like as shp2pgsql with same flags and output formats.
Example usage:
./bin/sxfino -p FILE.SXF
./bin/sxfino -p -d FILE.SXF
./bin/sxfino -r number:3702 FILE.SXF
./bin/sxfino -rg number:3702 FILE.SXF
Flag | Description | Required |
---|---|---|
-c |
Print record count | No |
-d |
Print descriptor of SXF | NO |
-f |
Flip coordinates | |
-gt |
All geometry print type (WKT, EWKT, WKB). Default: WKT. | No |
-h |
Print usage | No |
-p |
Print passport of SXF | No |
-q |
Not print warning messages | No |
-r |
Print record header, text (if exists), semantics (if exists) without geometry (incode:<i> - by incode, excode:<i> -by excode, number:<i> - by number | No |
-rg |
Print record geometry only (incode:<i> - by incode, excode:<i> - by excode, number:<i> - by number | No |
-s |
Set the SRID field. Defaults to 0. | No |
./bin/sxf2pgsql.sh -d -s 4326 /Users/iserge/Develop/Map/500\ 000 | psql -U postgres sxf
./bin/sxf2pgsql.sh -s 4326 /Users/iserge/Develop/Map/1\ 000\ 000 1kk | psql -U postgres sxf -q
Flag | Description | Required |
---|---|---|
-c |
Creates a new table and populates it, this is the default if you do not specify any options. | No |
-d |
Drops the table, then recreates it and populates it with current shape file data. | No |
-e |
Execute each statement individually, do not use a transaction. Not compatible with -D. | No |
-g |
Specify the name of the geometry/geography column. | No, default geog |
-h |
Display this help screen. | No |
-I |
Create a spatial index on the geocolumn. | No |
-s |
Set the SRID field. Defaults to detect from passport or 0. Optionally reprojects from given SRID | No |
-t |
Use only PostGIS coordinates transform (ST_Transform), Use with -s option. Not worked with -D. Default: client side convert | No |
-T |
Specify the tablespace for the new table. Note that indexes will still use the default tablespace unless the -X flag is also used. | No |
-w |
Output WKT instead of WKB. Note that this can result in coordinate drift. | No |
-W |
Specify the character encoding of SXF attribute column. | No, default UTF8 |
-X |
Specify the tablespace for the table's indexes. This applies to the primary key, index if the -I flag is used. | No |