[OpenLayers-Users] Re: problem with gml file in chrome and IE
Aris Dimopoulos
dimoaris at gmail.com
Wed Feb 23 03:13:59 EST 2011
Thanks for the reply. I've tried that without any success. using Chrome
developers tool i receive the following error but have no idea what that
means.
Failed to load resource
XMLHttpRequest cannot load .../openlayers/projects.gml. Cross origin
requests are only supported for HTTP.
XMLHttpRequest.js:222<http://dev.openlayers.org/releases/OpenLayers-2.10/lib/OpenLayers/Request/XMLHttpRequest.js>Uncaught
Error: NETWORK_ERR: XMLHttpRequest Exception 101
XMLHttpRequest cannot load .../openlayers/MASTS.gml. Cross origin requests
are only supported for HTTP.
Uncaught Error: NETWORK_ERR: XMLHttpRequest Exception 101
Aris
On 22 February 2011 15:05, Christian Mayer <mayer at terrestris.de> wrote:
> Hello,
>
> I am not quite sure if this is the solution but maybe you try:
>
> put the instanciation of the stylemap objects (myStyleMap, myStyleMap2)
> and before you use them. JSLint gives me warnings about that. Maybe this is
> the problem.
>
> Best regards,
> Chris
>
>
>
> Am 21.02.2011 08:44, schrieb adimopoulos:
>
> Hi again
>
> Just to update my previous post. I'm placing here the parts of my code. Hope
> someone can help....
>
> // Add a masts file
> var layer1 = new OpenLayers.Layer.GML("MASTS", "MASTS.gml",{
> projection: new OpenLayers.Projection("EPSG:4326") ,
> styleMap: myStyleMap,
> rendererOptions: {zIndexing: true}
>
> });
> // Add a projects file
> var layer2 = new OpenLayers.Layer.GML("projects", "./projects.gml",{
> projection: new OpenLayers.Projection("EPSG:4326"),
> formatOptions: {
> extractStyles: true,
> extractAttributes: true,
> maxDepth: 2
> },
> styleMap: myStyleMap2,
> rendererOptions: {zIndexing: true}
>
> });
>
> and my stile
>
> var myStyleMap = new OpenLayers.StyleMap( {
> "default":new OpenLayers.Style({
> fillColor: '${color1}', strokeColor: 'black', strokeOpacity:
> 0.8, strokeWidth: 0.8, fillOpacity: 0.8, pointRadius: "${radius}" },
> //call attribute of style in order to modify
> {
> context: {
> color1: function(feature) {
>
> if(feature.attributes.Status == "DEAD")
> {
>
> selectedColor = "red";
> }
> else
> {
>
> selectedColor = "green";
> }
> return selectedColor;
> },
> radius: function(feature) {
> return Math.min(Math.pow(Math.max(feature.attributes.Mean_u,
> 5), 1.9)*0.2, 13);
> }
> }
> }),
> "select":new OpenLayers.Style({
> fillColor: '#66ccff', strokeColor: 'black',
> strokeOpacity: 1, fillOpacity: 0.7, pointRadius: "5px" })
> });
> // projects style
> var myStyleMap2 = new OpenLayers.StyleMap( {
> "default": new OpenLayers.Style({
> fillColor: 'blue', strokeColor: '#3399ff',
> strokeOpacity: 1, fillOpacity: 0.5 }),
> "select": new OpenLayers.Style({
> fillColor: '#66ccff', strokeColor:
> '#3399ff', strokeOpacity: 1, fillOpacity: 0.5 })
> });
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110223/ff32bd42/attachment.html
More information about the Users
mailing list