useDynLib(sp,
	bboxCalcR_c,
	pointsInBox,
	Polygon_c,
	Polygon_validate_c,
	Polygons_c,
	R_point_in_polygon_sp,
	sp_zerodist,
	sp_duplicates,
	SpatialPolygons_c,
	SpatialPolygons_getIDs_c,
	SpatialPolygons_plotOrder_c,
	SpatialPolygons_validate_c,
	tList
)

importFrom(graphics, plot, hist, polygon, par, polypath, lines, strheight, 
	text, contour, axTicks, axis, rasterImage, image, box, plot.new, 
	plot.window, rect, segments, points, locator, identify, title,
	layout, lcm)
importFrom(stats, aggregate, na.omit, aggregate.data.frame, complete.cases, 
	quantile, as.formula, dist, runif, model.frame, na.fail)
import(utils)
importFrom(grid, grid.polygon, grid.path, grid.rect, polygonGrob, gpar,
	grid.layout, unit, frameGrob, placeGrob, rectGrob, grid.locator,
	grid.raster)
importFrom(grDevices, rgb, heat.colors)
import(methods)
import(lattice)

export(
	CRS,
	identicalCRS,
	# print.CRS, -> S3Method()

	# bbox,
	getGridIndex,
	points2grid,
	bpy.colors,
	bubble,
	mapasp,
	point.in.polygon,
	spmap.to.lev,
	zerodist,
	zerodist2,
	remove.duplicates,
	degAxis,
	"%over%",

	get_ll_warn,
	set_ll_warn,
	get_ll_TOL,
	set_ll_TOL,
	get_ReplCRS_warn,
	set_ReplCRS_warn,
	get_Polypath,
	set_Polypath,
	get_PolypathRule, 
	set_PolypathRule,
	set_col_regions,
	get_col_regions,

	coordinatevalues,

	dimensions,

	Spatial,
 
	SpatialPoints,
	SpatialPointsDataFrame,

	SpatialMultiPoints,
	SpatialMultiPointsDataFrame,

	Line,
	Lines,
	SpatialLines,
	SpatialLinesDataFrame,
	as.SpatialLines.SLDF,
	LineLength,
	LinesLength,
	SpatialLinesLengths,

	layout.scale.bar,
	layout.north.arrow,
	sp.theme,
	mapLegendGrob,
	spplot.key,
	panel.ggmap,
	panel.gridplot,
	panel.polygonsplot,
	panel.pointsplot,
	panel.RgoogleMaps,
	sp.polygons,
	sp.lines,
	sp.text,
	sp.points,
	sp.grid,
	SpatialPolygonsRescale,
	spplot.locator,
	sp.panel.layout,
	degreeLabelsEW,
	degreeLabelsNS,
	longlat.scales,
	bbexpand,
	compassRose,

	as.image.SpatialGridDataFrame,
	image2Grid,
	imageScale,
	
	gridparameters,
	SpatialPixels,
	SpatialPixelsDataFrame,
	SpatialGrid,
	SpatialGridDataFrame,
	GridTopology,
	getGridTopology,
	areaSpatialGrid,
	gridlines,
	gridat,
	gridIndex2nb,

	getSLlinesSlot,
	getLinesLinesSlot, 
	getLinesIDSlot,
	getSLLinesIDSlots,

	getSpatialLinesMidPoints,

	getPolygonCoordsSlot,
	getPolygonLabptSlot,
	getPolygonAreaSlot,
	getPolygonHoleSlot,
	getPolygonsPolygonsSlot,
	getPolygonsplotOrderSlot,
	getPolygonsLabptSlot,
	getPolygonsIDSlot,
	getSpPpolygonsSlot,
	getSpPplotOrderSlot,
	getSpPPolygonsLabptSlots,
	getSpPPolygonsIDSlots,
	getSpPnParts,
	getSpPnHoles,
	getSpatialPolygonsLabelPoints,

	select.spatial,

	as.SpatialPolygons.PolygonsList,
  # as.SpatialPolygonsDataFrame.SpatialPolygons, -> use coerce()

  # DMS:
	dd2dms, 
	print.DMS, 
	char2dms, 
	as.character.DMS,
	as.double.DMS, 
	as.numeric.DMS,

	# is coerce, but needed to add proj4string:
	as.SpatialPolygons.GridTopology, 

	# as.SpatialPolygons.SpatialPixels, -> is a coerce(), but plotKML uses it
	IDvaluesGridTopology, 
	IDvaluesSpatialPixels, 
	HexPoints2SpatialPolygons,

	flipHorizontal,
	flipVertical,

	loadMeuse,

	makegrid,

	overDF_for_rgeos, # for rgeos only!

	read.asciigrid, 

	Polygon,
	Polygons,

	cbind.Spatial,

	rbind.SpatialPoints,
	rbind.SpatialPointsDataFrame, 
	rbind.SpatialMultiPoints,
	rbind.SpatialMultiPointsDataFrame, 
	rbind.SpatialPixels,
	rbind.SpatialPixelsDataFrame,
	rbind.SpatialPolygons,
	rbind.SpatialPolygonsDataFrame,
	rbind.SpatialLines,
	rbind.SpatialLinesDataFrame,

	# sample.Spatial, -> coerce()...
	# sample.Line,
	# sample.Polygon,
	# sample.Polygons,
	# sample.Sgrid,

	# ShowSpatialPointsDataFrame -> coerce()...

	SpatialPolygons,
	SpatialPolygonsDataFrame,

	spDistsN1,
	spDists,

	write.asciigrid
)

exportClasses(
	DMS,
	CRS, 
	GridTopology,
	Line, 
	Lines,
	Polygon, 
	Polygons, 
	Spatial, 
	SpatialGrid, 
	SpatialGridDataFrame,
	SpatialLines, 
	SpatialLinesDataFrame,
	SpatialPixels, 
	SpatialPixelsDataFrame,
	SpatialPoints, 
 	SpatialPointsDataFrame, 
	SpatialMultiPoints, 
 	SpatialMultiPointsDataFrame, 
	SpatialPolygons, 
	SpatialPolygonsDataFrame,
	# spatstat classes:
	ppp, im, owin, psp
)

exportMethods(
	"[", "[[", "$", "$<-", 
	addAttrToGeom,
	bbox, 
	coerce, 
	coordinates, 
	"coordinates<-",
	coordnames, 
	"coordnames<-", 
	dimensions, 
	disaggregate,
	fullgrid,
	"fullgrid<-",
	geometry, 
	"geometry<-", 
	gridded,
	"gridded<-",
	is.projected,
	merge,
	over,
	# overlay,
	plot,
	polygons, 
	"polygons<-",
	proj4string,
	"proj4string<-",
	recenter,
	show, 
	spChFIDs,
	"spChFIDs<-",
	split,
	sppanel,
	spplot,
	spsample,
	summary,
	surfaceArea, 
	spTransform
)

S3method(as.array, SpatialGridDataFrame)

S3method(as.character, DMS)

S3method(as.data.frame, SpatialPoints)
S3method(as.data.frame, SpatialMultiPoints)
S3method(as.data.frame, SpatialPixels)
S3method(as.data.frame, SpatialGrid)
S3method(as.data.frame, SpatialPointsDataFrame)
S3method(as.data.frame, SpatialMultiPointsDataFrame)
S3method(as.data.frame, SpatialPixelsDataFrame)
S3method(as.data.frame, SpatialGridDataFrame)
S3method(as.data.frame, SpatialLinesDataFrame)
S3method(as.data.frame, SpatialPolygonsDataFrame)
S3method(as.data.frame, GridTopology)

S3method(as.double, DMS)
S3method(as.numeric, DMS)

S3method(as.matrix, SpatialGridDataFrame)
S3method(as.matrix, SpatialPixelsDataFrame)

S3method(aggregate, Spatial)

S3method(cbind, SpatialGridDataFrame)

S3method(contour, SpatialPixelsDataFrame)
S3method(contour, SpatialGridDataFrame)

S3method(dim, SpatialPointsDataFrame)
S3method(dim, SpatialMultiPointsDataFrame)
S3method(dim, SpatialLinesDataFrame)
S3method(dim, SpatialPolygonsDataFrame)
S3method(dim, SpatialPixelsDataFrame)
S3method(dim, SpatialGridDataFrame)

S3method(head, Spatial)

S3method(image, SpatialPixelsDataFrame)
S3method(image, SpatialPixels)
S3method(image, SpatialGridDataFrame)

S3method(labels, SpatialLines)

S3method(length, SpatialGrid)
S3method(length, SpatialLines)
S3method(length, SpatialPixels)
S3method(length, SpatialPoints)
S3method(length, SpatialMultiPoints)
S3method(length, SpatialPolygons)
S3method(length, SpatialGridDataFrame)
S3method(length, SpatialLinesDataFrame)
S3method(length, SpatialPixelsDataFrame)
S3method(length, SpatialPointsDataFrame)
S3method(length, SpatialMultiPointsDataFrame)
S3method(length, SpatialPolygonsDataFrame)

S3method(lines, Line)
S3method(lines, Lines)
S3method(lines, SpatialLines)
S3method(lines, SpatialLinesDataFrame)

S3method(names, SpatialPointsDataFrame)
S3method(names, SpatialMultiPointsDataFrame)
S3method(names, SpatialPixelsDataFrame)
S3method(names, SpatialGridDataFrame)
S3method(names, SpatialLinesDataFrame)
S3method(names, SpatialPolygonsDataFrame)
S3method(names, SpatialLines)
S3method(names, SpatialPolygons)
S3method(names, SpatialMultiPoints)

S3method("names<-", SpatialPointsDataFrame)
S3method("names<-", SpatialPolygonsDataFrame)
S3method("names<-", SpatialLinesDataFrame)
S3method("names<-", SpatialPixelsDataFrame)
S3method("names<-", SpatialGridDataFrame)

S3method(row.names, SpatialPoints)
S3method(row.names, SpatialMultiPoints)
S3method(row.names, SpatialLines)
S3method(row.names, SpatialPolygons)
S3method(row.names, SpatialPixels)
S3method(row.names, SpatialGrid)
S3method(row.names, SpatialPointsDataFrame)
S3method(row.names, SpatialLinesDataFrame)
S3method(row.names, SpatialPolygonsDataFrame)
S3method(row.names, SpatialGridDataFrame)

S3method("row.names<-", SpatialPoints)
S3method("row.names<-", SpatialMultiPoints)
S3method("row.names<-", SpatialPointsDataFrame)
S3method("row.names<-", SpatialPolygons)
S3method("row.names<-", SpatialPolygonsDataFrame)
S3method("row.names<-", SpatialLines)
S3method("row.names<-", SpatialLinesDataFrame)

S3method(points, SpatialPoints)
S3method(points, SpatialPointsDataFrame)
S3method(points, SpatialMultiPoints)
S3method(points, SpatialMultiPointsDataFrame)

S3method(print, CRS)
S3method(print, DMS)
S3method(print, GridTopology)
S3method(print, SpatialPoints)
S3method(print, SpatialMultiPoints)
S3method(print, SpatialPixels)
S3method(print, SpatialLines)
S3method(print, SpatialPointsDataFrame)
S3method(print, SpatialMultiPointsDataFrame)
S3method(print, SpatialPixelsDataFrame)
S3method(print, SpatialLinesDataFrame)
S3method(print, summary.Spatial)
S3method(print, summary.GridTopology)

S3method(split, SpatialPoints)

S3method(stack, SpatialPointsDataFrame)
S3method(stack, SpatialPixelsDataFrame)
S3method(stack, SpatialGridDataFrame)

S3method(subset, Spatial)

S3method(tail, Spatial)

S3method(text, SpatialPointsDataFrame)
