idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
1,600 | public boolean deleteValue ( String geoPackage , String property , String value ) { boolean deleted = false ; PropertiesCoreExtension < T , ? , ? , ? > properties = propertiesMap . get ( geoPackage ) ; if ( properties != null ) { deleted = properties . deleteValue ( property , value ) > 0 ; } return deleted ; } | Delete the property value from a specified GeoPackage |
1,601 | public int deleteAll ( ) { int count = 0 ; for ( String geoPackage : propertiesMap . keySet ( ) ) { if ( deleteAll ( geoPackage ) ) { count ++ ; } } return count ; } | Delete all properties and values from all GeoPackages |
1,602 | public boolean deleteAll ( String geoPackage ) { boolean deleted = false ; PropertiesCoreExtension < T , ? , ? , ? > properties = propertiesMap . get ( geoPackage ) ; if ( properties != null ) { deleted = properties . deleteAll ( ) > 0 ; } return deleted ; } | Delete all properties and values from a specified GeoPackage |
1,603 | public void removeExtension ( String geoPackage ) { PropertiesCoreExtension < T , ? , ? , ? > properties = propertiesMap . get ( geoPackage ) ; if ( properties != null ) { properties . removeExtension ( ) ; } } | Remove the extension from a specified GeoPackage |
1,604 | public void addColumn ( String tableName , String columnName , String columnDef ) { execSQL ( "ALTER TABLE " + CoreSQLUtils . quoteWrap ( tableName ) + " ADD COLUMN " + CoreSQLUtils . quoteWrap ( columnName ) + " " + columnDef + ";" ) ; } | Add a new column to the table |
1,605 | public < T > T querySingleTypedResult ( String sql , String [ ] args ) { @ SuppressWarnings ( "unchecked" ) T result = ( T ) querySingleResult ( sql , args ) ; return result ; } | Query the SQL for a single result typed object in the first column |
1,606 | public < T > List < T > querySingleColumnTypedResults ( String sql , String [ ] args ) { @ SuppressWarnings ( "unchecked" ) List < T > result = ( List < T > ) querySingleColumnResults ( sql , args ) ; return result ; } | Query for values from the first column |
1,607 | public void setApplicationId ( String applicationId ) { int applicationIdInt = ByteBuffer . wrap ( applicationId . getBytes ( ) ) . asIntBuffer ( ) . get ( ) ; execSQL ( String . format ( "PRAGMA application_id = %d;" , applicationIdInt ) ) ; } | Set the GeoPackage application id |
1,608 | public String getApplicationId ( ) { String applicationId = null ; Integer applicationIdObject = querySingleTypedResult ( "PRAGMA application_id" , null , GeoPackageDataType . MEDIUMINT ) ; if ( applicationIdObject != null ) { try { applicationId = new String ( ByteBuffer . allocate ( 4 ) . putInt ( applicationIdObject... | Get the application id |
1,609 | public int getUserVersion ( ) { int userVersion = - 1 ; Integer userVersionObject = querySingleTypedResult ( "PRAGMA user_version" , null , GeoPackageDataType . MEDIUMINT ) ; if ( userVersionObject != null ) { userVersion = userVersionObject ; } return userVersion ; } | Get the user version |
1,610 | public void fromBytes ( byte [ ] bytes ) { this . bytes = bytes ; ByteReader reader = new ByteReader ( bytes ) ; String magic = null ; try { magic = reader . readString ( 2 ) ; } catch ( UnsupportedEncodingException e ) { throw new GeoPackageException ( "Unexpected GeoPackage Geometry magic number character encoding: E... | Populate the geometry data from the bytes |
1,611 | public byte [ ] toBytes ( ) throws IOException { ByteWriter writer = new ByteWriter ( ) ; writer . writeString ( GeoPackageConstants . GEO_PACKAGE_GEOMETRY_MAGIC_NUMBER ) ; writer . writeByte ( GeoPackageConstants . GEO_PACKAGE_GEOMETRY_VERSION_1 ) ; byte flags = buildFlagsByte ( ) ; writer . writeByte ( flags ) ; writ... | Write the geometry to bytes |
1,612 | private int readFlags ( byte flags ) { int reserved7 = ( flags >> 7 ) & 1 ; int reserved6 = ( flags >> 6 ) & 1 ; if ( reserved7 != 0 || reserved6 != 0 ) { throw new GeoPackageException ( "Unexpected GeoPackage Geometry flags. Flag bit 7 and 6 should both be 0, 7=" + reserved7 + ", 6=" + reserved6 ) ; } int binaryType =... | Read the flags from the flag byte and return the envelope indicator |
1,613 | private byte buildFlagsByte ( ) { byte flag = 0 ; int binaryType = extended ? 1 : 0 ; flag += ( binaryType << 5 ) ; int emptyValue = empty ? 1 : 0 ; flag += ( emptyValue << 4 ) ; int envelopeIndicator = envelope == null ? 0 : getIndicator ( envelope ) ; flag += ( envelopeIndicator << 1 ) ; int byteOrderValue = ( byteOr... | Build the flags byte from the flag values |
1,614 | private GeometryEnvelope readEnvelope ( int envelopeIndicator , ByteReader reader ) { GeometryEnvelope envelope = null ; if ( envelopeIndicator > 0 ) { double minX = reader . readDouble ( ) ; double maxX = reader . readDouble ( ) ; double minY = reader . readDouble ( ) ; double maxY = reader . readDouble ( ) ; boolean ... | Read the envelope based upon the indicator value |
1,615 | private void writeEnvelope ( ByteWriter writer ) throws IOException { if ( envelope != null ) { writer . writeDouble ( envelope . getMinX ( ) ) ; writer . writeDouble ( envelope . getMaxX ( ) ) ; writer . writeDouble ( envelope . getMinY ( ) ) ; writer . writeDouble ( envelope . getMaxY ( ) ) ; if ( envelope . hasZ ( )... | Write the envelope bytes |
1,616 | public void setGeometry ( Geometry geometry ) { this . geometry = geometry ; empty = geometry == null ; if ( geometry != null ) { extended = GeometryExtensions . isNonStandard ( geometry . getGeometryType ( ) ) ; } } | Set the geometry . Updates the empty flag and if the geometry is not null the extended flag |
1,617 | public byte [ ] getWkbBytes ( ) { int wkbByteCount = bytes . length - wkbGeometryIndex ; byte [ ] wkbBytes = new byte [ wkbByteCount ] ; System . arraycopy ( bytes , wkbGeometryIndex , wkbBytes , 0 , wkbByteCount ) ; return wkbBytes ; } | Get the Well - Known Binary Geometry bytes |
1,618 | public ByteBuffer getWkbByteBuffer ( ) { return ByteBuffer . wrap ( bytes , wkbGeometryIndex , bytes . length - wkbGeometryIndex ) . order ( byteOrder ) ; } | Get the Well - Known Binary Geometry bytes already ordered in a Byte Buffer |
1,619 | public GeometryEnvelope getOrBuildEnvelope ( ) { GeometryEnvelope envelope = getEnvelope ( ) ; if ( envelope == null ) { Geometry geometry = getGeometry ( ) ; if ( geometry != null ) { envelope = GeometryEnvelopeBuilder . buildEnvelope ( geometry ) ; } } return envelope ; } | Get the envelope if it exists or build it from the geometry if not null |
1,620 | public static int getIndicator ( GeometryEnvelope envelope ) { int indicator = 1 ; if ( envelope . hasZ ( ) ) { indicator ++ ; } if ( envelope . hasM ( ) ) { indicator += 2 ; } return indicator ; } | Get the envelope flag indicator |
1,621 | public String getDefinition_12_063 ( long srsId ) { String definition = null ; if ( hasDefinition_12_063 ( ) ) { definition = crsWktExtension . getDefinition ( srsId ) ; } return definition ; } | Query to get the definition 12 063 value if the extension exists |
1,622 | public void setDefinition_12_063 ( SpatialReferenceSystem srs ) { if ( srs != null ) { String definition = getDefinition_12_063 ( srs . getSrsId ( ) ) ; if ( definition != null ) { srs . setDefinition_12_063 ( definition ) ; } } } | Query and set the definition 12 063 in the srs object if the extension exists |
1,623 | public void updateDefinition_12_063 ( SpatialReferenceSystem srs ) { if ( srs != null ) { String definition = srs . getDefinition_12_063 ( ) ; if ( definition != null ) { updateDefinition_12_063 ( srs . getSrsId ( ) , definition ) ; } } } | Update the definition 12 063 in the database if the extension exists |
1,624 | public SpatialReferenceSystem getOrCreateCode ( String organization , long coordsysId ) throws SQLException { SpatialReferenceSystem srs = queryForOrganizationCoordsysId ( organization , coordsysId ) ; srs = createIfNeeded ( srs , organization , coordsysId ) ; return srs ; } | Get or Create the Spatial Reference System for the provided organization and id |
1,625 | public SpatialReferenceSystem queryForOrganizationCoordsysId ( String organization , long organizationCoordsysId ) throws SQLException { SpatialReferenceSystem srs = null ; QueryBuilder < SpatialReferenceSystem , Long > qb = queryBuilder ( ) ; qb . where ( ) . like ( SpatialReferenceSystem . COLUMN_ORGANIZATION , organ... | Query for the organization coordsys id |
1,626 | private SpatialReferenceSystem createIfNeeded ( SpatialReferenceSystem srs , String organization , long id ) throws SQLException { if ( srs == null ) { if ( organization . equalsIgnoreCase ( ProjectionConstants . AUTHORITY_EPSG ) ) { switch ( ( int ) id ) { case ProjectionConstants . EPSG_WORLD_GEODETIC_SYSTEM : srs = ... | Create the srs if needed |
1,627 | public int deleteCascade ( SpatialReferenceSystem srs ) throws SQLException { int count = 0 ; if ( srs != null ) { ForeignCollection < Contents > contentsCollection = srs . getContents ( ) ; if ( ! contentsCollection . isEmpty ( ) ) { ContentsDao dao = getContentsDao ( ) ; dao . deleteCascade ( contentsCollection ) ; }... | Delete the Spatial Reference System cascading |
1,628 | public int deleteCascade ( Collection < SpatialReferenceSystem > srsCollection ) throws SQLException { int count = 0 ; if ( srsCollection != null ) { for ( SpatialReferenceSystem srs : srsCollection ) { count += deleteCascade ( srs ) ; } } return count ; } | Delete the collection of Spatial Reference Systems cascading |
1,629 | public int deleteCascade ( PreparedQuery < SpatialReferenceSystem > preparedDelete ) throws SQLException { int count = 0 ; if ( preparedDelete != null ) { List < SpatialReferenceSystem > srsList = query ( preparedDelete ) ; count = deleteCascade ( srsList ) ; } return count ; } | Delete the Spatial Reference Systems matching the prepared query cascading |
1,630 | public int deleteByIdCascade ( Long id ) throws SQLException { int count = 0 ; if ( id != null ) { SpatialReferenceSystem srs = queryForId ( id ) ; if ( srs != null ) { count = deleteCascade ( srs ) ; } } return count ; } | Delete a Spatial Reference System by id cascading |
1,631 | private ContentsDao getContentsDao ( ) throws SQLException { if ( contentsDao == null ) { contentsDao = DaoManager . createDao ( connectionSource , Contents . class ) ; } return contentsDao ; } | Get or create a Contents DAO |
1,632 | public static TileColumn createIdColumn ( int index ) { return new TileColumn ( index , TileTable . COLUMN_ID , GeoPackageDataType . INTEGER , null , false , null , true ) ; } | Create an id column |
1,633 | public static TileColumn createZoomLevelColumn ( int index ) { return new TileColumn ( index , TileTable . COLUMN_ZOOM_LEVEL , GeoPackageDataType . INTEGER , null , true , 0 , false ) ; } | Create a zoom level column |
1,634 | public static TileColumn createTileColumnColumn ( int index ) { return new TileColumn ( index , TileTable . COLUMN_TILE_COLUMN , GeoPackageDataType . INTEGER , null , true , 0 , false ) ; } | Create a tile column column |
1,635 | public static TileColumn createTileRowColumn ( int index ) { return new TileColumn ( index , TileTable . COLUMN_TILE_ROW , GeoPackageDataType . INTEGER , null , true , 0 , false ) ; } | Create a tile row column |
1,636 | public static TileColumn createTileDataColumn ( int index ) { return new TileColumn ( index , TileTable . COLUMN_TILE_DATA , GeoPackageDataType . BLOB , null , true , null , false ) ; } | Create a tile data column |
1,637 | public static void deleteTableExtensions ( GeoPackageCore geoPackage , String table ) { NGAExtensions . deleteTableExtensions ( geoPackage , table ) ; deleteRTreeSpatialIndex ( geoPackage , table ) ; deleteRelatedTables ( geoPackage , table ) ; deleteGriddedCoverage ( geoPackage , table ) ; deleteSchema ( geoPackage , ... | Delete all table extensions for the table within the GeoPackage |
1,638 | private static void delete ( GeoPackageCore geoPackage , String table ) { ExtensionsDao extensionsDao = geoPackage . getExtensionsDao ( ) ; try { if ( extensionsDao . isTableExists ( ) ) { extensionsDao . deleteByTableName ( table ) ; } } catch ( SQLException e ) { throw new GeoPackageException ( "Failed to delete Tabl... | Delete the extensions for the table |
1,639 | private static void delete ( GeoPackageCore geoPackage ) { ExtensionsDao extensionsDao = geoPackage . getExtensionsDao ( ) ; try { if ( extensionsDao . isTableExists ( ) ) { geoPackage . dropTable ( extensionsDao . getTableName ( ) ) ; } } catch ( SQLException e ) { throw new GeoPackageException ( "Failed to delete all... | Delete the extensions |
1,640 | public static void deleteRTreeSpatialIndex ( GeoPackageCore geoPackage , String table ) { RTreeIndexCoreExtension rTreeIndexExtension = getRTreeIndexExtension ( geoPackage ) ; if ( rTreeIndexExtension . has ( table ) ) { rTreeIndexExtension . delete ( table ) ; } } | Delete the RTree Spatial extension for the table |
1,641 | public static void deleteRTreeSpatialIndexExtension ( GeoPackageCore geoPackage ) { RTreeIndexCoreExtension rTreeIndexExtension = getRTreeIndexExtension ( geoPackage ) ; if ( rTreeIndexExtension . has ( ) ) { rTreeIndexExtension . deleteAll ( ) ; } } | Delete the RTree Spatial extension |
1,642 | private static RTreeIndexCoreExtension getRTreeIndexExtension ( GeoPackageCore geoPackage ) { return new RTreeIndexCoreExtension ( geoPackage ) { public void createMinYFunction ( ) { } public void createMinXFunction ( ) { } public void createMaxYFunction ( ) { } public void createMaxXFunction ( ) { } public void create... | Get a RTree Index Extension used only for deletions |
1,643 | public static void deleteRelatedTables ( GeoPackageCore geoPackage , String table ) { RelatedTablesCoreExtension relatedTablesExtension = getRelatedTableExtension ( geoPackage ) ; if ( relatedTablesExtension . has ( ) ) { relatedTablesExtension . removeRelationships ( table ) ; } } | Delete the Related Tables extensions for the table |
1,644 | public static void deleteRelatedTablesExtension ( GeoPackageCore geoPackage ) { RelatedTablesCoreExtension relatedTablesExtension = getRelatedTableExtension ( geoPackage ) ; if ( relatedTablesExtension . has ( ) ) { relatedTablesExtension . removeExtension ( ) ; } } | Delete the Related Tables extension |
1,645 | private static RelatedTablesCoreExtension getRelatedTableExtension ( GeoPackageCore geoPackage ) { return new RelatedTablesCoreExtension ( geoPackage ) { public String getPrimaryKeyColumnName ( String tableName ) { return null ; } } ; } | Get a Related Table Extension used only for deletions |
1,646 | public static void deleteGriddedCoverage ( GeoPackageCore geoPackage , String table ) { if ( geoPackage . isTableType ( ContentsDataType . GRIDDED_COVERAGE , table ) ) { GriddedTileDao griddedTileDao = geoPackage . getGriddedTileDao ( ) ; GriddedCoverageDao griddedCoverageDao = geoPackage . getGriddedCoverageDao ( ) ; ... | Delete the Gridded Coverage extensions for the table |
1,647 | public static void deleteGriddedCoverageExtension ( GeoPackageCore geoPackage ) { List < String > coverageTables = geoPackage . getTables ( ContentsDataType . GRIDDED_COVERAGE ) ; for ( String table : coverageTables ) { geoPackage . deleteTable ( table ) ; } GriddedTileDao griddedTileDao = geoPackage . getGriddedTileDa... | Delete the Gridded Coverage extension |
1,648 | public static void deleteSchema ( GeoPackageCore geoPackage , String table ) { DataColumnsDao dataColumnsDao = geoPackage . getDataColumnsDao ( ) ; try { if ( dataColumnsDao . isTableExists ( ) ) { dataColumnsDao . deleteByTableName ( table ) ; } } catch ( SQLException e ) { throw new GeoPackageException ( "Failed to d... | Delete the Schema extensions for the table |
1,649 | public static void deleteSchemaExtension ( GeoPackageCore geoPackage ) { SchemaExtension schemaExtension = new SchemaExtension ( geoPackage ) ; if ( schemaExtension . has ( ) ) { schemaExtension . removeExtension ( ) ; } } | Delete the Schema extension |
1,650 | public static void deleteMetadata ( GeoPackageCore geoPackage , String table ) { MetadataReferenceDao metadataReferenceDao = geoPackage . getMetadataReferenceDao ( ) ; try { if ( metadataReferenceDao . isTableExists ( ) ) { metadataReferenceDao . deleteByTableName ( table ) ; } } catch ( SQLException e ) { throw new Ge... | Delete the Metadata extensions for the table |
1,651 | public static void deleteMetadataExtension ( GeoPackageCore geoPackage ) { MetadataExtension metadataExtension = new MetadataExtension ( geoPackage ) ; if ( metadataExtension . has ( ) ) { metadataExtension . removeExtension ( ) ; } } | Delete the Metadata extension |
1,652 | public static void deleteCrsWktExtension ( GeoPackageCore geoPackage ) { CrsWktExtension crsWktExtension = new CrsWktExtension ( geoPackage ) ; if ( crsWktExtension . has ( ) ) { crsWktExtension . removeExtension ( ) ; } } | Delete the WKT for Coordinate Reference Systems extension |
1,653 | private static TileMatrix getTileMatrixAtLengthIndex ( List < TileMatrix > tileMatrices , int index ) { return tileMatrices . get ( tileMatrices . size ( ) - index - 1 ) ; } | Get the tile matrix represented by the current length index |
1,654 | public static Long getApproximateZoomLevel ( double [ ] widths , double [ ] heights , List < TileMatrix > tileMatrices , double length ) { return getApproximateZoomLevel ( widths , heights , tileMatrices , length , length ) ; } | Get the approximate zoom level for the provided length in the default units . Tiles may or may not exist for the returned zoom level . The approximate zoom level is determined using a factor of 2 from the zoom levels with tiles . |
1,655 | public static Long getApproximateZoomLevel ( double [ ] widths , double [ ] heights , List < TileMatrix > tileMatrices , double width , double height ) { Long widthZoomLevel = getApproximateZoomLevel ( widths , tileMatrices , width ) ; Long heightZoomLevel = getApproximateZoomLevel ( heights , tileMatrices , height ) ;... | Get the approximate zoom level for the provided width and height in the default units . Tiles may or may not exist for the returned zoom level . The approximate zoom level is determined using a factor of 2 from the zoom levels with tiles . |
1,656 | private static Long getApproximateZoomLevel ( double [ ] lengths , List < TileMatrix > tileMatrices , double length ) { Long lengthZoomLevel = null ; double minLength = lengths [ 0 ] ; double maxLength = lengths [ lengths . length - 1 ] ; if ( length < minLength ) { double levelsIn = Math . log ( length / minLength ) /... | Get the approximate zoom level for length using the factor of 2 rule between zoom levels |
1,657 | public static double getMaxLength ( double [ ] widths , double [ ] heights ) { double maxWidth = getMaxLength ( widths ) ; double maxHeight = getMaxLength ( heights ) ; double maxLength = Math . min ( maxWidth , maxHeight ) ; return maxLength ; } | Get the max distance length that matches the tile widths and heights |
1,658 | public static double getMinLength ( double [ ] widths , double [ ] heights ) { double minWidth = getMinLength ( widths ) ; double minHeight = getMinLength ( heights ) ; double minLength = Math . max ( minWidth , minHeight ) ; return minLength ; } | Get the min distance length that matches the tile widths and heights |
1,659 | public GriddedTile query ( String tableName , long tileId ) { GriddedTile griddedTile = null ; try { QueryBuilder < GriddedTile , Long > qb = queryBuilder ( ) ; qb . where ( ) . eq ( GriddedTile . COLUMN_TABLE_NAME , tableName ) . and ( ) . eq ( GriddedTile . COLUMN_TABLE_ID , tileId ) ; PreparedQuery < GriddedTile > q... | Query by table name and table id |
1,660 | public GeoPackageDataType getDataType ( String type ) { GeoPackageDataType dataType = null ; try { dataType = GeoPackageDataType . fromName ( type ) ; } catch ( IllegalArgumentException dataTypeException ) { try { GeometryType . fromName ( type ) ; dataType = GeoPackageDataType . BLOB ; } catch ( IllegalArgumentExcepti... | Get the data type of the string type . |
1,661 | public void setColor ( String color ) { setRed ( ColorUtils . getRed ( color ) ) ; setGreen ( ColorUtils . getGreen ( color ) ) ; setBlue ( ColorUtils . getBlue ( color ) ) ; String alpha = ColorUtils . getAlpha ( color ) ; if ( alpha != null ) { setAlpha ( alpha ) ; } } | Set the color in hex |
1,662 | public void setColor ( String red , String green , String blue , String alpha ) { setColor ( red , green , blue ) ; setAlpha ( alpha ) ; } | Set the color with individual hex colors and alpha |
1,663 | public void setColor ( int color ) { setRed ( ColorUtils . getRed ( color ) ) ; setGreen ( ColorUtils . getGreen ( color ) ) ; setBlue ( ColorUtils . getBlue ( color ) ) ; if ( color > 16777215 || color < 0 ) { setAlpha ( ColorUtils . getAlpha ( color ) ) ; } } | Set the color as a single integer |
1,664 | public int index ( boolean force ) { int count = 0 ; if ( force || ! isIndexed ( ) ) { getOrCreateExtension ( ) ; TableIndex tableIndex = getOrCreateTableIndex ( ) ; createOrClearGeometryIndices ( ) ; geoPackage . unindexGeometryIndexTable ( ) ; count = indexTable ( tableIndex ) ; geoPackage . indexGeometryIndexTable (... | Index the feature table |
1,665 | protected boolean index ( TableIndex tableIndex , long geomId , GeoPackageGeometryData geomData ) { boolean indexed = false ; if ( geomData != null ) { GeometryEnvelope envelope = geomData . getOrBuildEnvelope ( ) ; if ( envelope != null ) { GeometryIndex geometryIndex = geometryIndexDao . populate ( tableIndex , geomI... | Index the geometry id and geometry data |
1,666 | protected void updateLastIndexed ( ) { TableIndex tableIndex = new TableIndex ( ) ; tableIndex . setTableName ( tableName ) ; tableIndex . setLastIndexed ( new Date ( ) ) ; try { tableIndexDao . createOrUpdate ( tableIndex ) ; } catch ( SQLException e ) { throw new GeoPackageException ( "Failed to update last indexed d... | Update the last indexed time |
1,667 | public boolean deleteIndex ( ) { boolean deleted = false ; ExtensionsDao extensionsDao = geoPackage . getExtensionsDao ( ) ; TableIndexDao tableIndexDao = geoPackage . getTableIndexDao ( ) ; try { if ( tableIndexDao . isTableExists ( ) ) { deleted = tableIndexDao . deleteByIdCascade ( tableName ) > 0 ; } if ( extension... | Delete the feature table index |
1,668 | public int deleteIndex ( long geomId ) { int deleted = 0 ; GeometryIndexKey key = new GeometryIndexKey ( tableName , geomId ) ; try { deleted = geometryIndexDao . deleteById ( key ) ; } catch ( SQLException e ) { throw new GeoPackageException ( "Failed to delete index, GeoPackage: " + geoPackage . getName ( ) + ", Tabl... | Delete the index for the geometry id |
1,669 | public boolean isIndexed ( ) { boolean indexed = false ; Extensions extension = getExtension ( ) ; if ( extension != null ) { ContentsDao contentsDao = geoPackage . getContentsDao ( ) ; try { Contents contents = contentsDao . queryForId ( tableName ) ; if ( contents != null ) { Date lastChange = contents . getLastChang... | Determine if the feature table is indexed |
1,670 | private TableIndex getOrCreateTableIndex ( ) { TableIndex tableIndex = getTableIndex ( ) ; if ( tableIndex == null ) { try { if ( ! tableIndexDao . isTableExists ( ) ) { geoPackage . createTableIndexTable ( ) ; } tableIndex = new TableIndex ( ) ; tableIndex . setTableName ( tableName ) ; tableIndex . setLastIndexed ( n... | Get or create if needed the table index |
1,671 | public TableIndex getTableIndex ( ) { TableIndex tableIndex = null ; try { if ( tableIndexDao . isTableExists ( ) ) { tableIndex = tableIndexDao . queryForId ( tableName ) ; } } catch ( SQLException e ) { throw new GeoPackageException ( "Failed to query for Table Index for GeoPackage: " + geoPackage . getName ( ) + ", ... | Get the table index |
1,672 | private int clearGeometryIndices ( ) { int deleted = 0 ; DeleteBuilder < GeometryIndex , GeometryIndexKey > db = geometryIndexDao . deleteBuilder ( ) ; try { db . where ( ) . eq ( GeometryIndex . COLUMN_TABLE_NAME , tableName ) ; PreparedDelete < GeometryIndex > deleteQuery = db . prepare ( ) ; deleted = geometryIndexD... | Clear the Geometry Indices for the table name |
1,673 | private boolean createGeometryIndexTable ( ) { boolean created = false ; try { if ( ! geometryIndexDao . isTableExists ( ) ) { created = geoPackage . createGeometryIndexTable ( ) ; } } catch ( SQLException e ) { throw new GeoPackageException ( "Failed to create Geometry Index table for GeoPackage: " + geoPackage . getN... | Create the Geometry Index Table if needed |
1,674 | public BoundingBox getBoundingBox ( ) { GenericRawResults < Object [ ] > results = null ; Object [ ] values = null ; try { results = geometryIndexDao . queryRaw ( "SELECT MIN(" + GeometryIndex . COLUMN_MIN_X + "), MIN(" + GeometryIndex . COLUMN_MIN_Y + "), MAX(" + GeometryIndex . COLUMN_MAX_X + "), MAX(" + GeometryInde... | Query for the bounds of the feature table index |
1,675 | public QueryBuilder < GeometryIndex , GeometryIndexKey > queryBuilder ( ) { QueryBuilder < GeometryIndex , GeometryIndexKey > qb = geometryIndexDao . queryBuilder ( ) ; try { qb . where ( ) . eq ( GeometryIndex . COLUMN_TABLE_NAME , tableName ) ; } catch ( SQLException e ) { throw new GeoPackageException ( "Failed to b... | Build a query builder to query for all Geometry Index objects |
1,676 | public long count ( BoundingBox boundingBox ) { GeometryEnvelope envelope = boundingBox . buildEnvelope ( ) ; long count = count ( envelope ) ; return count ; } | Query for Geometry Index count within the bounding box projected correctly |
1,677 | public CloseableIterator < GeometryIndex > query ( GeometryEnvelope envelope ) { CloseableIterator < GeometryIndex > geometryIndices = null ; QueryBuilder < GeometryIndex , GeometryIndexKey > qb = queryBuilder ( envelope ) ; try { geometryIndices = qb . iterator ( ) ; } catch ( SQLException e ) { throw new GeoPackageEx... | Query for Geometry Index objects within the Geometry Envelope |
1,678 | public long count ( GeometryEnvelope envelope ) { long count = 0 ; QueryBuilder < GeometryIndex , GeometryIndexKey > qb = queryBuilder ( envelope ) ; try { count = qb . countOf ( ) ; } catch ( SQLException e ) { throw new GeoPackageException ( "Failed to query for Geometry Index count. GeoPackage: " + geoPackage . getN... | Query for Geometry Index count within the Geometry Envelope |
1,679 | public QueryBuilder < GeometryIndex , GeometryIndexKey > queryBuilder ( GeometryEnvelope envelope ) { QueryBuilder < GeometryIndex , GeometryIndexKey > qb = geometryIndexDao . queryBuilder ( ) ; try { double minX = envelope . getMinX ( ) - tolerance ; double maxX = envelope . getMaxX ( ) + tolerance ; double minY = env... | Build a query builder to query for Geometry Index objects within the Geometry Envelope |
1,680 | public Extensions getOrCreate ( String tableName , String columnName , GeometryType geometryType ) { String extensionName = getExtensionName ( geometryType ) ; Extensions extension = getOrCreate ( extensionName , tableName , columnName , GEOMETRY_TYPES_EXTENSION_DEFINITION , ExtensionScopeType . READ_WRITE ) ; return e... | Get or create the extension non - linear geometry type |
1,681 | public boolean has ( String tableName , String columnName , GeometryType geometryType ) { String extensionName = getExtensionName ( geometryType ) ; boolean exists = has ( extensionName , tableName , columnName ) ; return exists ; } | Determine if the GeoPackage has the extension non - linear geometry type |
1,682 | public static boolean isExtension ( GeometryType geometryType ) { return GeometryCodes . getCode ( geometryType ) > GeometryCodes . getCode ( GeometryType . GEOMETRYCOLLECTION ) ; } | Determine if the geometry type is an extension |
1,683 | public static boolean isNonStandard ( GeometryType geometryType ) { return GeometryCodes . getCode ( geometryType ) > GeometryCodes . getCode ( GeometryType . SURFACE ) ; } | Determine if the geometry type is non standard |
1,684 | public static boolean isGeoPackageExtension ( GeometryType geometryType ) { return GeometryCodes . getCode ( geometryType ) >= GeometryCodes . getCode ( GeometryType . CIRCULARSTRING ) && GeometryCodes . getCode ( geometryType ) <= GeometryCodes . getCode ( GeometryType . SURFACE ) ; } | Determine if the geometry type is a GeoPackage extension |
1,685 | public static String getExtensionName ( GeometryType geometryType ) { if ( ! isExtension ( geometryType ) ) { throw new GeoPackageException ( GeometryType . class . getSimpleName ( ) + " is not an extension: " + geometryType . getName ( ) ) ; } if ( ! isGeoPackageExtension ( geometryType ) ) { throw new GeoPackageExcep... | Get the extension name of a GeoPackage extension Geometry |
1,686 | public Extensions getOrCreate ( String tableName , String columnName , String author , GeometryType geometryType ) { String extensionName = getExtensionName ( author , geometryType ) ; String description = isGeoPackageExtension ( geometryType ) ? GEOMETRY_TYPES_EXTENSION_DEFINITION : USER_GEOMETRY_TYPES_EXTENSION_DEFIN... | Get or create the extension user defined geometry type |
1,687 | protected void duplicateCheck ( int index , Integer previousIndex , String column ) { if ( previousIndex != null ) { throw new GeoPackageException ( "More than one " + column + " column was found for table '" + tableName + "'. Index " + previousIndex + " and " + index ) ; } } | Check for duplicate column names |
1,688 | protected void typeCheck ( GeoPackageDataType expected , TColumn column ) { GeoPackageDataType actual = column . getDataType ( ) ; if ( actual == null || ! actual . equals ( expected ) ) { throw new GeoPackageException ( "Unexpected " + column . getName ( ) + " column data type was found for table '" + tableName + "', ... | Check for the expected data type |
1,689 | protected void missingCheck ( Integer index , String column ) { if ( index == null ) { throw new GeoPackageException ( "No " + column + " column was found for table '" + tableName + "'" ) ; } } | Check for missing columns |
1,690 | public int getColumnIndex ( String columnName ) { Integer index = nameToIndex . get ( columnName ) ; if ( index == null ) { throw new GeoPackageException ( "Column does not exist in table '" + tableName + "', column: " + columnName ) ; } return index ; } | Get the column index of the column name |
1,691 | public TColumn getPkColumn ( ) { TColumn column = null ; if ( hasPkColumn ( ) ) { column = columns . get ( pkIndex ) ; } return column ; } | Get the primary key column |
1,692 | public List < TColumn > columnsOfType ( GeoPackageDataType type ) { List < TColumn > columnsOfType = new ArrayList < > ( ) ; for ( TColumn column : columns ) { if ( column . getDataType ( ) == type ) { columnsOfType . add ( column ) ; } } return columnsOfType ; } | Get the columns with the provided data type |
1,693 | public static boolean hasGeoPackageExtension ( File file ) { String extension = GeoPackageIOUtils . getFileExtension ( file ) ; boolean isGeoPackage = extension != null && ( extension . equalsIgnoreCase ( GeoPackageConstants . GEOPACKAGE_EXTENSION ) || extension . equalsIgnoreCase ( GeoPackageConstants . GEOPACKAGE_EXT... | Check the file extension to see if it is a GeoPackage |
1,694 | public static void validateGeoPackageExtension ( File file ) { if ( ! hasGeoPackageExtension ( file ) ) { throw new GeoPackageException ( "GeoPackage database file '" + file + "' does not have a valid extension of '" + GeoPackageConstants . GEOPACKAGE_EXTENSION + "' or '" + GeoPackageConstants . GEOPACKAGE_EXTENDED_EXT... | Validate the extension file as a GeoPackage |
1,695 | public static boolean hasMinimumTables ( GeoPackageCore geoPackage ) { boolean hasMinimum ; try { hasMinimum = geoPackage . getSpatialReferenceSystemDao ( ) . isTableExists ( ) && geoPackage . getContentsDao ( ) . isTableExists ( ) ; } catch ( SQLException e ) { throw new GeoPackageException ( "Failed to check for requ... | Check the GeoPackage for the minimum required tables |
1,696 | public static void validateMinimumTables ( GeoPackageCore geoPackage ) { if ( ! hasMinimumTables ( geoPackage ) ) { throw new GeoPackageException ( "Invalid GeoPackage. Does not contain required tables: " + SpatialReferenceSystem . TABLE_NAME + " & " + Contents . TABLE_NAME + ", GeoPackage Name: " + geoPackage . getNam... | Validate the GeoPackage has the minimum required tables |
1,697 | public int deleteByExtension ( String extensionName ) throws SQLException { DeleteBuilder < Extensions , Void > db = deleteBuilder ( ) ; db . where ( ) . eq ( Extensions . COLUMN_EXTENSION_NAME , extensionName ) ; int deleted = db . delete ( ) ; return deleted ; } | Delete by extension name |
1,698 | public int deleteByExtension ( String extensionName , String tableName ) throws SQLException { DeleteBuilder < Extensions , Void > db = deleteBuilder ( ) ; setUniqueWhere ( db . where ( ) , extensionName , true , tableName , false , null ) ; int deleted = db . delete ( ) ; return deleted ; } | Delete by extension name and table name |
1,699 | public List < Extensions > queryByExtension ( String extensionName ) throws SQLException { QueryBuilder < Extensions , Void > qb = queryBuilder ( ) ; setUniqueWhere ( qb . where ( ) , extensionName , false , null , false , null ) ; List < Extensions > extensions = qb . query ( ) ; return extensions ; } | Query by extension name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.