# How to draw multiple shapefiles at the same time

So i have this code to draw a single shapefile layer i tried different ways to render mutliple layers the first layer draws countries borders and the second layer draws us roads and highways but i can only gett the countries borders to show but i deleted the code that supposed to draw the second layer but again that code did not work

``````void latLonToXYZ(double lat, double lon, double& x, double& y, double& z) {
const double R = 1.0 * 0.4666; // Multiply the radius by the scale factor
double latRad = lat * M_PI / 180.0;
double lonRad = lon * M_PI / 180.0;
}

void drawShapefilePolygons(const std::vector<SHPObject*>& objects) {
glColor3f(1.0f, 1.0f, 1.0f); // Set the color for the shapefile polygons

// Define translation and rotation values
float translationX = 0.0f; // Adjust this value to move the shapefile along the x-axis
float rotationZ = 0.0f; // Adjust this value to rotate the shapefile around the z-axis
float rotationX = 269.8f; // Adjust this value to tilt the shapefile up or down

// Apply translation and rotation transformations
glPushMatrix();
glTranslatef(translationX, 0, 0);
glRotatef(rotationX, 1, 0, 0); // Apply the rotation around the x-axis
glRotatef(rotationZ, 0, 0, 1);
for (const auto& object : objects) {
if (object->nSHPType == SHPT_POLYGON) {
for (int i = 0; i < object->nParts; i++) {
int startVertex = object->panPartStart[i];
int endVertex = (i == object->nParts - 1) ? object->nVertices : object->panPartStart[i + 1];
glBegin(GL_LINE_LOOP);
for (int j = startVertex; j < endVertex; j++) {
double x, y, z;
glVertex3d(x, y, z); // Pass the 3D coordinates to OpenGL
}
glEnd();
}
}
}

glPopMatrix();
}

std::vector<SHPObject*> objects;

std::cerr << "Failed to open shapefile: " << filename << std::endl;
return objects;
}

int nEntities;
int nShapeType;

for (int i = 0; i < nEntities; i++) {
if (object == nullptr) {
std::cerr << "Failed to read shapefile object" << std::endl;
continue;
}
objects.push_back(object);
}

return objects;
}

int main() {
const char* filename = "C:/Users/---/Desktop/BOLTgui/BOLT/shapefiles/WorldBorders.shp";

std::cerr << "Failed to open shapefile: " << filename << std::endl;
return EXIT_FAILURE;
}

// Extract the first polygon from the shapefile