PDA

View Full Version : shape files



nitin.crl
03-29-2009, 11:19 PM
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

S.Seegel
03-30-2009, 03:10 AM
Do you mean this (http://en.wikipedia.org/wiki/Shapefile) 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.

nitin.crl
03-31-2009, 10:07 PM
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

S.Seegel
04-01-2009, 01:03 AM
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 !

nitin.crl
04-01-2009, 02:49 AM
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.

ZbuffeR
04-01-2009, 06:31 AM
Are you kidding ?
First result for "shapefile lib" http://shapelib.maptools.org/

nitin.crl
04-07-2009, 09:45 PM
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

S.Seegel
04-08-2009, 04:30 AM
(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 ;)

nitin.crl
04-09-2009, 09:48 PM
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

Durga Prasad
04-29-2010, 08:55 AM
I have explained this in this article ...
http://www.codeproject.com/KB/openGL/RenderSHP.aspx