Exemple #1
0
void OgrWriter::writeElement(ElementInputStream& inputStream, bool debug)
{
  // Make sure incoming element is in WGS84
  assert( inputStream.getProjection()->IsSame(&_wgs84) == true );
  ElementPtr nextElement = inputStream.readNextElement();

  writeElement(nextElement, debug);
}
Exemple #2
0
void OgrWriter::writeElement(ElementInputStream& inputStream, bool debug)
{
  // Make sure incoming element is in WGS84
  assert( inputStream.getProjection()->IsSame(&_wgs84) == true );
  ElementPtr nextElement = inputStream.readNextElement();

  // TERRY TESTING COULD BE CATASTROPHIC
  Tags sourceTags = nextElement->getTags();
  Tags destTags;
  for (Tags::const_iterator it = nextElement->getTags().begin();
       it != nextElement->getTags().end(); ++it)
  {
    if (sourceTags[it.key()] != "")
    {
      destTags.appendValue(it.key(), it.value());
    }
  }
  // Now that all the empties are gone, update our element
  nextElement->setTags(destTags);

  if ( debug == true )
  {
    LOG_DEBUG(nextElement->toString());
  }

  PartialOsmMapWriter::writePartial(nextElement);
  /*
  if ( nextElement->getElementType().getEnum() == ElementType::Node )
  {
    //LOG_DEBUG("\n" << nextElement->toString());

    const long nodeID = nextElement->getId();
    if ( (nodeID >= -265198) && (nodeID <= -265167) )
    {
      LOG_DEBUG("\n" << nextElement->toString());
      PartialOsmMapWriter::writePartial(nextElement);
    }
  }
  else if ((nextElement->getElementType().getEnum() == ElementType::Way) &&
           (nextElement->getId() == -23189) )
  {
    LOG_DEBUG("Writing Little Mill Creek -23189");
    LOG_DEBUG("\n" << nextElement->toString());
    PartialOsmMapWriter::writePartial(nextElement);
  }
  */
}
void ElementCacheLRU::writeElement(ElementInputStream& inputStream)
{
  boost::shared_ptr<OGRSpatialReference> emptyProjection;

  // Find out if we need to set our projection
  if ( _projection == emptyProjection )
  {
    _projection = inputStream.getProjection();
  }
  else
  {
    // Make sure they haven't shifted projections on us
    if ( inputStream.getProjection()->IsSame(&(*_projection)) == false )
    {
      LOG_ERROR("Tried to change projections in mid-stream");
      return;
    }
  }
  ConstElementPtr newElement = inputStream.readNextElement();
  addElement(newElement);
}