Changeset 33128 for main/trunk/greenstone2
- Timestamp:
- 2019-06-06T20:53:13+12:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/doc.pm
r33126 r33128 1138 1138 1139 1139 if($field =~ m/^(.+\.)?Longitude$/) { 1140 # if we are dealing with Longitude meta, we should 1. have Latitude meta ; 2. already have processed Latitude meta1140 # if we are dealing with Longitude meta, we should 1. have Latitude meta too; 2. already have processed Latitude meta 1141 1141 # in that case, add both Lat and Lng of this section as a Coordinate meta 1142 1142 my $latitude = $self->get_metadata_element ($section, "Latitude"); 1143 1143 # TODO: would like all Longitude info together followed by all Coordinate info, but the following will add all coord info meta and end of this function will add Longitude meta 1144 $self->processCoordinate($section _ptr, $latitude, $value); # value is Longitude1144 $self->processCoordinate($section, $latitude, $value); # value is Longitude 1145 1145 } 1146 1146 } 1147 1147 1148 1148 elsif($field eq "GPS.mapOverlay") { # then the value is a JSON string 1149 1150 # TODO: 1151 # If we already have Coordinate meta for this section of the document (as can happen during buildcol.pl), 1152 # let's ASSUME this means we've already processed GPS.mapOverlay meta into Coordinate meta for this section (can have happened during import.pl) 1153 # to avoid adding duplicate Coordinates meta, which then end up duplicated in the index 1154 # Of course, the assumption is not always true! We could have an image with embedded Lat and Lng meta, 1155 # and the same image doc's section could have GPS.mapOverlay meta (from shapes) added via the doc editor. 1156 # This very function would then have converted Lat/Lng into Coordinate meta (just in the if stmt above) and added it to the section. 1157 # And then by the time we process this section's GPS.mapOverlay meta here, we would notice the section has Coordinate meta already, 1158 # and therefore skip converting the GPS.mapOverlay meta into Coordinate meta! What to dooooo? 1159 # So the return statement immediately below is a temporary solution, until we find a better one that will always work. 1160 my $metaMap = $self->get_metadata_hashmap($section); 1161 if($metaMap->{'Coordinate'}) { 1162 return; 1163 } 1164 1149 1165 print STDERR "GPS.mapOverlay before val: " . $value . "\n"; 1150 1166 … … 1214 1230 print STDERR "cos $centre_lat is $cos_lat\n"; 1215 1231 1216 $self->processCoordinate($section _ptr, $lat_north, $lng_east);1217 $self->processCoordinate($section _ptr, $lat_south, $lng_east);1218 $self->processCoordinate($section _ptr, $lat_south, $lng_west);1219 $self->processCoordinate($section _ptr, $lat_north, $lng_west);1232 $self->processCoordinate($section, $lat_north, $lng_east); 1233 $self->processCoordinate($section, $lat_south, $lng_east); 1234 $self->processCoordinate($section, $lat_south, $lng_west); 1235 $self->processCoordinate($section, $lat_north, $lng_west); 1220 1236 1221 1237 } … … 1223 1239 print STDERR "@@ MARKER FOUND WITH LAT: " . $shape->{"position"}->{"lat"} . "\n"; 1224 1240 print STDERR "@@ MARKER FOUND WITH LNG: " . $shape->{"position"}->{"lng"} . "\n"; 1225 $self->processCoordinate($section _ptr, $shape->{"position"}->{"lat"}, $shape->{"position"}->{"lng"});1241 $self->processCoordinate($section, $shape->{"position"}->{"lat"}, $shape->{"position"}->{"lng"}); 1226 1242 } 1227 1243 elsif ($type eq "polyline" || $type eq "polygon") { 1228 1244 my $path_array = $shape->{"path"}; 1229 1245 foreach my $position (@$path_array) { 1230 $self->processCoordinate($section _ptr, $position->{"lat"}, $position->{"lng"});1246 $self->processCoordinate($section, $position->{"lat"}, $position->{"lng"}); 1231 1247 } 1232 1248 } … … 1235 1251 my $bounds = $shape->{"bounds"}; 1236 1252 1237 $self->processCoordinate($section _ptr, $bounds->{"north"}, $bounds->{"east"});1238 $self->processCoordinate($section _ptr, $bounds->{"south"}, $bounds->{"east"});1239 $self->processCoordinate($section _ptr, $bounds->{"south"}, $bounds->{"west"});1240 $self->processCoordinate($section _ptr, $bounds->{"north"}, $bounds->{"west"});1253 $self->processCoordinate($section, $bounds->{"north"}, $bounds->{"east"}); 1254 $self->processCoordinate($section, $bounds->{"south"}, $bounds->{"east"}); 1255 $self->processCoordinate($section, $bounds->{"south"}, $bounds->{"west"}); 1256 $self->processCoordinate($section, $bounds->{"north"}, $bounds->{"west"}); 1241 1257 } 1242 1258 … … 1280 1296 sub processCoordinate { 1281 1297 my $self = shift (@_); 1282 my ($section_ptr, $latitude, $longitude) = @_; 1298 my ($section, $latitude, $longitude) = @_; 1299 1300 my $section_ptr = $self->_lookup_section($section); 1283 1301 1284 1302 my $lat_direction = ($latitude =~ m/^-/) ? "S" : "N";
Note:
See TracChangeset
for help on using the changeset viewer.