shape files

Hi everyone
I am working on displaying .shp(shape) files in OpenGL so if you all can just help me out in knowing how to display thm
thanks
Nitin

Do you mean this file format ?
At a first glance it seems to be fairly simple. A .shp file may contain points, lines or polygons.
Points and lines can be directly fed to opengl. Polygons need to be tessellated into triangles first.

hi
thanks a lot for your reply
if you have some sample code related to this then just give me a link to it.
Thanks

Nope, I haven’t used this format myself yet.

I don’t know what your experience level with opengl or programming in general is, but if you got stuck on any specific problem, feel free to ask !

i have not gone in depth into OpenGL.
i m just working on how to display .shp files in OpenGL on linu platform
i have got many libraries to use in windows but nothing useful in linux so far.

Are you kidding ?
First result for “shapefile lib” http://shapelib.maptools.org/

hi
i have gone through the details of shape files.
Just wanna know a method to use them in my OpenGL application.
If you have a sample code or any useful link on how to use thm thn kindly send it to me

(1) Read the primitives (points/lines/polygons) from the shapefile,

(2) tessellate polygons into triangles (you might want to take a look at GLU), and

(3) send them to opengl for rasterization.

You might want to use the bounding box provided in the shapefile header to set up your projection matrix, so the geometry will actually fit in your window.

If this doesn’t (fully) answer your question, maybe you should ask more detailed :wink:

hi
thanks a lot for your reply.
i am not able to open .shp file for rading the primitives.
so can u kindly suggest me how to do it
thanks

I have explained this in this article …
http://www.codeproject.com/KB/openGL/RenderSHP.aspx

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.