<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
I have a quick question about the ShapeFileObj class in PHP mapscript
then I'd like to throw out an offer and see who wants to take me up on
it. <br>
<br>
First my question. I'm trying to write a quick data exporter. The
general process is, query a spatial database, loop through the results
and build a shapefile, export the shapefile. I'm not having any
run-time failures but my result has only .SHP, .SHX files.&nbsp; When I look
at the shapefile in ogrinfo I see my points but no projection,&nbsp; and
when I use ogr2ogr to add a projection I see that there's no attribute
information...only the points.<br>
<br>
My code looks similar to this:<br>
<font color="#666666"><br>
</font><font color="#666666" face="Courier New, Courier, monospace"
 size="-1">// Open map object<br>
$map = ms_newmapobj($mapPath);<br>
$layer = $map-&gt;getLayerByName($layerName);<br>
<br>
// Create shapefileobj with random name<br>
$rnd = time();<br>
$filePath = "C:\\Inetpub\\wwwroot\\tmp\\Extract\\$rnd";<br>
$fileName = $filePath . "somename"; // no extension<br>
<br>
$oShapeFile = ms_newShapefileObj($fileName, $layerType); // assume
MS_SHP_POINT for this example<br>
<br>
$status = $layer-&gt;open();<br>
$status = $layer-&gt;whichShapes($map-&gt;extent);<br>
while ($shape = $layer-&gt;nextShape())<br>
{&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; $id = $shape-&gt;values[$idField];<br>
&nbsp;&nbsp;&nbsp; echo "Adding shape with ID = $id\n";<br>
&nbsp;&nbsp;&nbsp; $oShapeFile-&gt;addShape($shape);&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; $shape-&gt;free();<br>
}<br>
$layer-&gt;close();<br>
$oShapeFile-&gt;free();</font><font color="#666666"><br>
<br>
</font><font color="#666666" face="Courier New, Courier, monospace"
 size="-1">// zip up and return to browser</font><br>
<br>
Any suggestions would be appreciated. <br>
<br>
Now my offer.&nbsp; I usually get by with the available documentation and a
decent archive of old projects to compare from. The documentation for
this object is pretty sparse:
<a class="moz-txt-link-freetext" href="http://mapserver.org/mapscript/php/index.html#shapefileobj-class">http://mapserver.org/mapscript/php/index.html#shapefileobj-class</a>&nbsp; The
SWIG api doc looks about the same. I'd like to put together an example
for each class function to flesh out the doc. If there are a lot of
interested participants we could do all the classes,&nbsp; but for now I'll
start with ShapeFileObj.&nbsp; If there's something like this on the go
already, let me know how I can help. <br>
<br>
Thanks, <br>
<br>
Josh Hevenor<br>
</body>
</html>