load part of large shapefile

Mar 9, 2011 at 2:19 PM

Hi people,

i've a shapefile with world's oceans; in my application is needed to load only a particular world section, so i want to load only the related part of oceans shapefile;

is it possible to load at runtime and visualize only a part of shapefile? How can i perform this?


Thanks a lot!!!

Mar 9, 2011 at 11:44 PM


Simple solution would be delete unnecessarily shapes after loading and before displaying shape file with oceans on a screen.

Another solution allows to display any required amount of shapes on a screen in runtime.

You can create memory shape file (memory_shp), open another shape file with oceans from hard drive (real_shp), then copy only required shapes from real_shp to memory_shp and display memory _shp on a screen.

Also you can close and destroy real_shp or you can keep it in the memory, so just in case if you need to reload different shapes in runtime, you can delete all shapes in memory_shp and copy new shapes from real_shp.

This method I used once and it worked quite fast for me.

Hope it helps.

Apr 5, 2011 at 12:57 PM

ok, but how can i select the shapes? for example, in oceans shapes i have a certain number of shapes, and each one represents one of the seas in the world...how can i select only the shapes of europe via code?


Apr 5, 2011 at 2:52 PM

Hi seum,

I guess something missing to answer. How do you want to select your shapes?

by attributes, or by intersection with an other polygon (polygon representing europe for example)?

Apr 5, 2011 at 2:59 PM

i want to perform a selection in a certain area...for example i want only european seas...

Apr 5, 2011 at 3:03 PM

... always missing the way you want operate the selections, is there's a column in the shapefile to help select, or an other polygon from an other shapefile which touches some of sea's polygons or is the selection must be done only with the coordinates of a rectangle(xmax xmin ymax ymin)?

Apr 5, 2011 at 3:08 PM


if i've said "in a certain area", i mean a rectangle...i hope now it's clear!

Thanks for your time!

Apr 5, 2011 at 3:27 PM
dim xt as new mapwingis.extents
dim resu as variant
dim success as boolean
dim i as integer
dim sfOcean as new mapwingis.shapefile
  success = sfOcean..Open("theShapefileEmplacement")
  xt.setbounds(the coordinates of the rectangle)
  success = sfOcean.selectshapes(xt,0,resu)

   if success then
       for i = 0 to ubound(resu)
          'to access to the shapes selected :
          'you can add them in a new shapefile or only changes their symbology
       next i
  end if
this is VB6
For me area can be something else than a rectangle, but my english is probably not good enough
Apr 6, 2011 at 7:59 AM

very good!

you've centered the solution!

Thanks for your help!!

P.S. my english is surely worst then yours ;)