Sorry
f1=open("/users/rsg/jmdj/points.dic","r")
On 11/03/11 09:29, Jorge de Jesus wrote:
> Outra maneira.... quick and dirty....
>
>
> Basta remover do inicio
> var toAdd = [
>
> e do fim
> ];
>
> Que ficas com um dicionario em python, gravas o conteudo num ficheiro
> (points.dic) e depois tens de abrir o ficheiro e processar as
> coordenadas (que sao chaves do dicionario) cria um objecto geojson,
> passar a polygono e depois pedir o WKT, depois numa consola de python
> podes fazer
>
> import geojson
> from shapely.geometry import asShape
>
> f1=open(f2=open("/users/rsg/jmdj/points.dic","r")
> q = geojson.loads(f1.read())
> #q ==<type 'dict>
> coords=q["coords"] #dicionario con coord x,y
> coodinates=[[[item["x"],item["y"]] for item in coords] # converter em list
> coordinates.append(coordinates[0]) #append o primeiro ponto ao ultimo
> polygon={"type":"Polygon"},"coordinates":[coordinates]} #assumindo que
> o poligono nao tem buracos
>
> polygonShape=asShape(polygon)
> #polyShap==<class 'shapely.geometry.polygon.PolygonAdapter'>
> print polygonShap.to_wkt()
>
>
>
> Jorge
>
> On 10/03/11 23:27, carlos sousa wrote:
>> Como poderão ver pelo screen em anexo, no googlemaps aparece
>> correctamente o ficheiro original do diego, convertido para kml usando
>> o ogr2ogr ...
>>
>> Carlos
>>
>> 2011/3/10 carlos sousa <[email protected]>:
>>> Boa Noite,
>>>
>>> Com a ajuda "rapidissima" do Diego, o problema ficou resolvido mas
>>> tenho um pequeno desvio do shapefile resultante, quando projectado em
>>> cima dos meus mapas em EPSG:20790.
>>> Se calhar foi porque os dados originalmente foram extraídos de uma
>>> página google maps em que a projecção estaria em EPSG:900913 (google
>>> mercator)???
>>> Não tenho a certeza mas foi um passo de gigante para ter isto quase
>>> aprontado.
>>>
>>> Cumprimentos
>>>
>>> 2011/3/10 Jose Gonçalves <[email protected]>:
>>>> Caro Carlos
>>>>
>>>> Se utilizar um editor de texto que faça substituição de caracteres
>>>> especiais
>>>> (por exemplo o textpad) consegue formatar o ficheiro de texto com lista de
>>>> coordenadas com um ponto por linha. Um dos conjuntos de caracteres pode ser
>>>> substituído por "\n" (um enter) e os restantes podem ser apagados ou
>>>> substituídos por espaços.
>>>> No final deve ficar com uma lista de coordenadas que suponho que estarão na
>>>> ordem lat long. Pode trocar a ordem com o awk ou com uma folha de cálculo.
>>>> Falta só adaptar a lista de coordenadas para o formato BNA, que é um
>>>> formato
>>>> de texto (Basta acrescentar um cabeçalho à lista de coordenadas). Pode ver
>>>> informações sobre o formato em:
>>>>
>>>> http://www.softwright.com/faq/support/boundary_file_bna_format.html
>>>>
>>>> Finalmente pode passar a outro formato, como shapefile ou KML, com o
>>>> comando
>>>> ogr2ogr.
>>>>
>>>>
>>>> Cumprimentos
>>>>
>>>>
>>>> José A. Gonçalves
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Em 10 de março de 2011 20:38, carlos sousa <[email protected]>
>>>> escreveu:
>>>>> Caros amigos,
>>>>>
>>>>> Diz o ditado popular que quem se mete por atalhos, mete se em
>>>>> trabalhos, mas será que eu consigo fazer uma reconstrução de um
>>>>> polígono a partir dos dados, que estão em anexo, para um formato tipo
>>>>> WKT e que possa ser transformado em SHAPEFILE?
>>>>> É porque senão, tenho de "digitalizar" a partir de ficheiros png que
>>>>> não tem georeferẽncia nenhuma.
>>>>>
>>>>> Obrigado
>>>>>
>>>>> Carlos
>>>>>
>>>>> _______________________________________________
>>>>> Portugal mailing list
>>>>> [email protected]
>>>>> http://lists.osgeo.org/mailman/listinfo/portugal
>>>>>
>>>> _______________________________________________
>>>> Portugal mailing list
>>>> [email protected]
>>>> http://lists.osgeo.org/mailman/listinfo/portugal
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Portugal mailing list
>>> [email protected]
>>> http://lists.osgeo.org/mailman/listinfo/portugal
>
>
> ------------------------------------------------------------------------
>
> Plymouth Marine Laboratory
> Registered Office:
> Prospect Place
> The Hoe
> Plymouth PL1 3DH
>
> Website: www.pml.ac.uk <http://www.pml.ac.uk>
> Click here for PML Annual Review 2010
> <http://www.pml.ac.uk/pdf/PMLAR2010.pdf>
> Registered Charity No. 1091222
> PML is a company limited by guarantee
> registered in England & Wales
> company number 4178503
>
> Please think before you print.
>
> ------------------------------------------------------------------------
>
> This e-mail, its content and any file attachments are confidential.
>
> If you have received this e-mail in error please do not copy, disclose
> it to any third party or use the contents or attachments in any way.
> Please notify the sender by replying to this e-mail or e-mail
> [email protected] and then delete the email without making any copies
> or using it in any other way.
>
> The content of this message may contain personal views which are not
> the views of Plymouth Marine Laboratory unless specifically stated.
>
> You are reminded that e-mail communications are not secure and may
> contain viruses. Plymouth Marine Laboratory accepts no liability for
> any loss or damage which may be caused by viruses.
>
> ------------------------------------------------------------------------
>
>
>
> _______________________________________________
> Portugal mailing list
> [email protected]
> http://lists.osgeo.org/mailman/listinfo/portugal
--------------------------------------------------------------------------------
Plymouth Marine Laboratory
Registered Office:
Prospect Place
The Hoe
Plymouth PL1 3DH
Website: www.pml.ac.uk
Click here for PML Annual Review 2010
Registered Charity No. 1091222
PML is a company limited by guarantee
registered in England & Wales
company number 4178503
Please think before you print
--------------------------------------------------------------------------------
This e-mail, its content and any file attachments are confidential.
If you have received this e-mail in error please do not copy, disclose it to
any third party or use the contents or attachments in any way. Please notify
the sender by replying to this e-mail or e-mail [email protected] and then
delete the email without making any copies or using it in any other way.
The content of this message may contain personal views which are not the views
of Plymouth Marine Laboratory unless specifically stated.
You are reminded that e-mail communications are not secure and may contain
viruses. Plymouth Marine Laboratory accepts no liability for any loss or damage
which may be caused by viruses.
--------------------------------------------------------------------------------
_______________________________________________
Portugal mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/portugal