Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

in my Openlayers app, since the base map projection is not epsg900913 or 4326, I need to include proj4js in order to use geolocation feature. but i got such a error notice:

 GET http://svn.osgeo.org/metacrs/proj4js/trunk/lib/projCode/null.js 404 (Not Found)

i am wondering how come this null.js is needed here. the funny thing is i can't find this file from proj4js lib files..

anybody can help me out?

thanks!!

Code:

<!DOCTYPE html> 
<html> 
    <head> 
<link rel="stylesheet" href="theme/default/style.css" type="text/css"> 
<link rel="stylesheet" href="style.css" type="text/css"> 
<script type="text/javascript" src="http://svn.osgeo.org/metacrs/proj4js/trunk/lib/proj4js.js"></script>
<script src="http://openlayers.org/dev/OpenLayers.js"></script> 

    </head> 
    <body> 
    <div id="map" class="smallmap"></div> 
<script  type="text/javascript">
    var map = new OpenLayers.Map({
    div: "map",
    projection: new OpenLayers.Projection("EPSG:26912"),
    layers: [
        new OpenLayers.Layer("",{isBaseLayer: true}),
        new OpenLayers.Layer.Vector("KML", {
            strategies: [new OpenLayers.Strategy.Fixed()],
            protocol: new OpenLayers.Protocol.HTTP({
                url: "test.kml",
                format: new OpenLayers.Format.KML({
                    extractStyles: true, 
                    extractAttributes: true,
                    maxDepth: 2
                })
            })
        })
    ]
});

map.zoomToMaxExtent();
</script>
    </body> 
</html> 
share|improve this question
    
Try to reformulate the title to a question, for example "How do I include proj4js in openlayers?" –  MathiasWestin Aug 12 '11 at 6:44

3 Answers 3

up vote 2 down vote accepted

After looking at your code it seems the error is in the definition of EPSG26912 where a colon is missing. Try the changes on local copy and then report them to the developers. You should never link to code from SVN trunk, anyway because of both performance and stability issues. Instead use a stable version of proj4js or a local checkout.

share|improve this answer
    
Hi thanks for your reply. i attached the code, i don't know why i got that null.js 404-not-found error after including proj4js.js header file. –  Simon Aug 13 '11 at 3:54
    
cool.. forgive my carelessness.. –  Simon Aug 13 '11 at 17:23
projection:"EPSG:26912"

should be

projection: new OpenLayers.Projection("EPSG:26912");

Add this before:

Proj4js.defs["EPSG:26912"] = "+proj=utm +zone=12 +ellps=GRS80 +datum=NAD83 +units=m +no_defs";
share|improve this answer
    
thanks for this notice. however, it doesn't work. –  Simon Aug 13 '11 at 17:15

This isn't an answer yet, but hopefully we'll be able to work it to there. I've got a pretty simple projection up here which should allow us to test the answer proposed by @ilia and figure out something which we can all get to work.

I've put essentially the complex example of Proj4JS from http://openlayers.org/dev/examples/using-proj4js.html here: http://jsfiddle.net/cpwqA/

What's the simplest that we can make this? I've tried to do one up here with a basic projection: http://jsfiddle.net/5jRX9/

It doesn't work, but much of the interesting stuff is in the Manage resources section in the sidebar.

The defaults I'm pulling in from: http://spatialreference.org/ref/epsg/26912/proj4js/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.