[Gfoss] Problema Proiezioni wfs+OSM in GeoExt
Fabio D'Ovidio
fabiodovidio a gmail.com
Lun 28 Nov 2011 11:59:48 CET
Ciao Nicola,
il tuo geoserver riconosce la proj EPSG:900913 ? (mi pare sia built in ma
non ricordo da quale versione....)
se no, devi inserirgliela tu...altrimenti il server non riesce a
riproiettare lo strato vettoriale WFS:
http://docs.openlayers.org/library/spherical_mercator.html
Il giorno 28 novembre 2011 11:54, Nicola De Innocentis <
deinnocentis.nicola a gmail.com> ha scritto:
> Ciao a tutti,
> ho un problema di proiezione tra un layer OSM e un wfs proveniente da
> Geoserver. Il tutto è visualizzato in un MapPanel di GeoExt.
> Il problema è che mentre OSM è puntato sulla zona giusta (Napoli) i punti
> si trovano sovrapposti di fronte all'Africa!!
> Vi posto un po' di codice,se qualcuno può darci uno sguardo,gli sarei
> molto grato :
>
>
> Ext.onReady(function(){
>
> var lat=40.85000;
> var lon=14.25622;
> var zoom=14;
>
> var map = new OpenLayers.Map ("map", {
>
> maxExtent: new
> OpenLayers.Bounds(-19602834.611,-6328326.120,19259229.394,15761277.666),
>
> maxResolution: 156543.0399,
>
> units: 'm',
> projection: new OpenLayers.Projection("EPSG:900913"),
>
> displayProjection: new OpenLayers.Projection("EPSG:4326")
> });
>
> var openstreetmap = new OpenLayers.Layer.OSM();
>
>
> var vecLayer = new OpenLayers.Layer.Vector("vector");
> map.addLayers([openstreetmap,vecLayer]);
>
> // create feature store, binding it to the vector layer
> var store = new GeoExt.data.FeatureStore({
> layer: vecLayer,
> fields: [
> {name: 'id', type: 'integer'},
>
> ],
> proxy: new GeoExt.data.ProtocolProxy({
> protocol: new OpenLayers.Protocol.WFS({
> url: "
> http://localhost/proxy.php?url=http://odata.it:8080/geoserver/wfs",
> featureType: "prova",
> featureNS: "http://www.openplans.org/topp",
> srs: 'EPSG:4326',
> geometryName: "the_geom",
> schema: "
> http://localhost/proxy.php?url=http://localhost/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=topp:prova
> "
>
>
>
> /* new OpenLayers.Protocol.HTTP({
> url: "store.json",
> format: new OpenLayers.Format.GeoJSON()*/
> })
> }),
> autoLoad: true
> });
>
>
> var mapPanel= new GeoExt.MapPanel({
> renderTo:'mainpanel',
> height: 300,
> width: 950,
> map: map,
> center:new OpenLayers.LonLat( lon ,lat ).transform( new
> OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()),
> zoom:13,
> title: 'Mappa '
> });
>
> Cordiali Saluti,Nicola.
>
> _______________________________________________
> Iscriviti all'associazione GFOSS.it: http://www.gfoss.it/drupal/iscrizione
> Gfoss a lists.gfoss.it
> http://lists.gfoss.it/cgi-bin/mailman/listinfo/gfoss
> Questa e' una lista di discussione pubblica aperta a tutti.
> Non inviate messaggi commerciali.
> I messaggi di questa lista non rispecchiano necessariamente
> le posizioni dell'Associazione GFOSS.it.
> 540 iscritti al 4.11.2011
>
-------------- parte successiva --------------
Un allegato HTML ? stato rimosso...
URL: <http://lists.gfoss.it/pipermail/gfoss/attachments/20111128/4fb15322/attachment-0001.html>
Maggiori informazioni sulla lista
Gfoss