[GeoJSON] Aligning implementations

Tim Schaub noreply at geocartic.com
Tue Apr 10 11:31:57 PDT 2007


Chris Holmes wrote:
>>> [multiple geometries]
>>> what do I do?  
>>
>> {
>>      id: string,
>>      geometry: array,
>>      properties: object
>> }
>>
> 
> Yeah, I don't really like that so much.  If you have multiple geometries 
> people will probably want names for them.  Ie which one's the building 
> and which one's the lot.  If you just have an array you don't know which 
> is which.

I don't like it either.  But if you want geometries to have arbitrary 
names, then a geometry object would look like:

{
     type: string,
     data: array,
     name: string
}

and you could iterate through all your geometry objects in the 
feature.geometry array to find the name you want.

If you really want geometries to be keyed by arbitrary names, then 
you'll have to iterate through all keys to get all geometries anyway.

Again, I don't like this, but I think it is preferable to iterating 
through all the keys of the properties object and testing each value to 
see whether or not it is a geometry.  What if I want to name my geometry 
link or title?  Are those forbidden names for geometry because they are 
also optional properties?


Tim



More information about the GeoJSON mailing list