Shapefile questions

Sandeep Bashyal gis at UNDPHAIS.ORG.NP
Tue Oct 5 00:18:41 EDT 2004


On Tue, 5 Oct 2004 09:33:45 +0545, Sandeep Bashyal <gis at UNDPHAIS.ORG.NP>
wrote:

> On Fri, 1 Oct 2004 08:42:44 -0400, Lowell Filak <lfilak at MEDINACO.ORG>
> wrote:
>
>> The following message was sent by Sandeep Bashyal <gis at UNDPHAIS.ORG.NP>
>> on Fri, 1 Oct 2004 10:35:33 +0545.
>>
>>> Hello,
>>>
>>> I have the following questions about shapefiles and mapserver:
>>>
>>> 1. Does Mapserver support "merged" polygons in shapefiles? E.g. arcview
>>> allows you to merge two or more NON-ADJACENT polygons, such that they
>>> are
>>> treated as a single shape and point to the same rows in the attribute
>>> table. I was wondering if mapserver supports such shapefiles with
>>> merged
>>> non-adjacent polygons.
>>>
>>> 2. Is there a way to assign shapeindex for shapes in a layer from one
>>> of
>>> the fields in the attribute table (like in the mapfile or by dnamically
>>> adding a layer with phpmapscript)? I have a layer with over 4000
>>> polygons
>>> whose attribute ID's do not correspond to the shapeindex returned from
>>> query results. I need the attribute ID's to link to a external database
>>> and display results.
>>>
>>> Any advice on an easy way to write shapeindexes into a field in the
>>> attribute table would also be helpful.
>>>
>>> Thanks in advance.
>>>
>>> --
>>> Sandeep Bashyal
>>
>> Sandeep,
>>
>> I don't know about #1. I, think, technically because a shape is not
>> actually defined as a polygon it could actually be composed of many
>> polygons. However there are many on this list more qualified to answer
>> this.
>> For #2. If the records in the attribute table you are trying to relate
>> have a 1:1 relationship with the shapes in the shapefile then you may be
>> able to add the shape index to the attribute table as a sequential
>> number If the attribute records are loaded in the same sequence as the
>> shapes occur. The more probable solution is have the ID as a field in
>> the DBF that is associated with the SHP file and use the shape index to
>> extract the ID from the DBF and then extract the attributes from the
>> table.
>>
>> HTH
>>
>> Lowell
>>
>
> Thanks for the response. I was able to get the shapeindex as a feild in
> the attribute table. I'm thinking of creating an sql table containing the
> shapeindex and the corresponding ID (or using the dbf file itself) and
> extracting the the corresponding ID's to display query results from an
> external database. Is there an easier way to do this? Can I get attribute
> values back into php directly from query results?

Please disregard the above post. I can get the ID using
$shape->values["ID"]. I should have read the docs more carefully. Thanks
for your help again.

--
Sandeep Bashyal
--
   National GIS Officer
   Humanitarian Assistance Information System (HAIS)
   United Nations (NEP/01/008)
   UN House, Pulchowk
   G.P.O. Box 107
   Kathmandu, Nepal
   Tel: (+977) 01 5543957
        (+977) 01 5554304
   Cell:(+977) 9841270854
   Fax: (+977) 01 5528059
--------------------------------------------------
mailto:gis at undphais.org.np
mailto:sandeep at earthmapping.com
http://www.undp.org.np



More information about the mapserver-users mailing list