Skip to content

Commit

Permalink
Merge pull request #155 from stansmith907/dev
Browse files Browse the repository at this point in the history
Fix bug that returns first identifier as parentId when no SB namespace is found
  • Loading branch information
jlblcc authored Oct 25, 2017
2 parents c648f14 + 62e3f86 commit b43cad4
Show file tree
Hide file tree
Showing 165 changed files with 9,248 additions and 698 deletions.
57 changes: 49 additions & 8 deletions lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb
Original file line number Diff line number Diff line change
Expand Up @@ -780,21 +780,22 @@ def newSpatialReferenceSystem
{
systemType: nil,
systemIdentifier: {},
systemParameters: {}
systemParameterSet: {}
}
end

def newReferenceSystemParameters
def newReferenceSystemParameterSet
{
projection: {},
ellipsoid: {},
datumIdentifier: {}
verticalDatum: {}
}
end

def newProjection
{
projectionIdentifier: {},
projectionName: nil,
zone: nil,
standardParallel1: nil,
standardParallel2: nil,
Expand All @@ -808,11 +809,18 @@ def newProjection
longitudeOfProjectionCenter: nil,
latitudeOfProjectionCenter: nil,
scaleFactorAtCenterLine: nil,
scaleFactorAtCentralMeridian: nil,
straightVerticalLongitudeFromPole: nil,
scaleFactorAtProjectionOrigin: nil,
azimuthAngle: nil,
azimuthMeasurePointLongitude: nil,
obliqueLinePoint: []
obliqueLinePoints: [],
landsatNumber: nil,
landsatPath: nil,
localPlanarDescription: nil,
localPlanarGeoreference: nil,
otherProjectionDescription: nil,
otherGridDescription: nil
}
end

Expand All @@ -826,6 +834,7 @@ def newObliqueLinePoint
def newEllipsoid
{
ellipsoidIdentifier: {},
ellipsoidName: nil,
semiMajorAxis: nil,
axisUnits: nil,
denominatorOfFlatteningRatio: nil
Expand All @@ -836,7 +845,9 @@ def newSpatialResolution
{
scaleFactor: nil,
measure: {},
geographicMeasure: {},
coordinateResolution: {},
bearingDistanceResolution: {},
geographicResolution: {},
levelOfDetail: nil
}
end
Expand All @@ -849,14 +860,44 @@ def newMeasure
}
end

def newGeographicMeasure
def newCoordinateResolution
{
latitudeMeasure: nil,
longitudeMeasure: nil,
abscissaResolutionX: nil,
ordinateResolutionY: nil,
unitOfMeasure: nil
}
end

def newBearingDistanceResolution
{
distanceResolution: nil,
distanceUnitOfMeasure: nil,
bearingResolution: nil,
bearingUnitOfMeasure: nil,
bearingReferenceDirection: nil,
bearingReferenceMeridian: nil
}
end

def newGeographicResolution
{
latitudeResolution: nil,
longitudeResolution: nil,
unitOfMeasure: nil
}
end

def newVerticalDatum
{
datumIdentifier: {},
isDepthSystem: false,
encodingMethod: nil,
verticalResolution: nil,
unitOfMeasure: nil
}

end

def newSpatialRepresentation
{
gridRepresentation: {},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Reader - fgdc to internal data structure
# unpack fgdc map projection - albers

# History:
# Stan Smith 2017-10-04 original script

require 'nokogiri'
require 'adiwg/mdtranslator/internal/internal_metadata_obj'
require_relative 'projection_common'

module ADIWG
module Mdtranslator
module Readers
module Fgdc

module AlbersProjection

def self.unpack(xParams, hProjection, hResponseObj)

# map projection 4.1.2.1.2 (albers) - Albers Conical Equal Area
unless xParams.empty?
paramCount = 0
hProjection[:projectionName] = 'albers'

# -> ReferenceSystemParameters.projection.standardParallel1
# -> ReferenceSystemParameters.projection.standardParallel2
paramCount += ProjectionCommon.unpackStandParallel(xParams, hProjection, hResponseObj)

# -> ReferenceSystemParameters.projection.longitudeOfCentralMeridian
paramCount += ProjectionCommon.unpackLongCM(xParams, hProjection, hResponseObj)

# -> ReferenceSystemParameters.projection.latitudeOfProjectionOrigin
paramCount += ProjectionCommon.unpackLatPO(xParams, hProjection, hResponseObj)

# -> ReferenceSystemParameters.projection.falseEasting
# -> ReferenceSystemParameters.projection.falseNorthing
paramCount += ProjectionCommon.unpackFalseNE(xParams, hProjection, hResponseObj)

# verify parameter count
if paramCount == 6
return hProjection
else
hResponseObj[:readerExecutionMessages] << 'albers projection is missing one or more parameters'
return nil
end
end

return nil

end

end

end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Reader - fgdc to internal data structure
# unpack fgdc map projection - azimuth equidistant

# History:
# Stan Smith 2017-10-16 original script

require 'nokogiri'
require 'adiwg/mdtranslator/internal/internal_metadata_obj'
require_relative 'projection_common'

module ADIWG
module Mdtranslator
module Readers
module Fgdc

module AzimuthEquidistantProjection

def self.unpack(xParams, hProjection, hResponseObj)

# map projection 4.1.2.1.3 (azimequi) - Azimuthal Equidistant
unless xParams.empty?
paramCount = 0
hProjection[:projectionName] = 'azimuthal equidistant'

# -> ReferenceSystemParameters.projection.longitudeOfCentralMeridian
paramCount += ProjectionCommon.unpackLongCM(xParams, hProjection, hResponseObj)

# -> ReferenceSystemParameters.projection.latitudeOfProjectionOrigin
paramCount += ProjectionCommon.unpackLatPO(xParams, hProjection, hResponseObj)

# -> ReferenceSystemParameters.projection.falseEasting
# -> ReferenceSystemParameters.projection.falseNorthing
paramCount += ProjectionCommon.unpackFalseNE(xParams, hProjection, hResponseObj)

# verify parameter count
if paramCount == 4
return hProjection
else
hResponseObj[:readerExecutionMessages] << 'azimuth equidistant projection is missing one or more parameters'
return nil
end
end

return nil

end

end

end
end
end
end
Loading

0 comments on commit b43cad4

Please sign in to comment.