Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • shp2dta problem with coordinates

    Hi,
    This is driving me crazy.
    Using UK government shapefiles I get coordinated with impossible values.
    https://geoportal.statistics.gov.uk/...d_Clipped).zip

    shp2dta using "//Users/paul/Documents/Mapping/Boundaries/European/European_electoral_regions_(GB)_2013_Boundaries_(G eneralised_Clipped)/EER
    > _DEC_2013_GB_BGC.shp", database("eur") coordinates("eurco") replace
    . use "/Users/paul/Documents/Mapping/Boundaries/European/eurco.dta"
    . l in 2

    +---------------------------+
    | _ID _X _Y |
    |---------------------------|
    2. | 1 450252.2 525902.2 |
    +---------------------------+

    Thanks if you have the time to help

    Paul

  • #2
    Code:
    shp2dta using EER_DEC_2013_GB_BGC.shp, database(GB.dta) coor(GBcoor.dta) genid(id) replace
    
    spmap using GBcoor.dta, id(id) poly(data(GBcoor.dta) fcolor(red))
    looks fine to me.

    Comment


    • #3
      Hmmm... upon further examination, I think I see your point -- the coordinates aren't remotely in Great Britain. Relative to each other, they're fine, but it's a strange set of coordinates.

      Comment


      • #4
        The shapefile contains projected coordinates (in this case in meters). The juicy details of the projection used are found in the "EER_DEC_2013_GB_BGC.prj" file:

        Code:
        PROJCS["British_National_Grid",
        GEOGCS["GCS_OSGB_1936",DATUM["D_OSGB_1936",
        SPHEROID["Airy_1830",6377563.396,299.3249646]],
        PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],
        PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",400000.0],
        PARAMETER["False_Northing",-100000.0],PARAMETER["Central_Meridian",-2.0],
        PARAMETER["Scale_Factor",0.9996012717],
        PARAMETER["Latitude_Of_Origin",49.0],UNIT["Meter",1.0]]

        Comment


        • #5
          Thanks Guys, yes I see my problem - shp2dta is producing coordinates from the shapefile, which are no use when I try to kmlmap to use with Google Fusion table.

          Robert, does the shapefile also contain long/lat data?

          geo2xy will convert long/lat to cartesian for me but it is the other way I want to go.

          (geo2xy -- Convert latitude and longitude to cartesian (x,y) coordinates using map projections)

          Any suggestions?

          Paul

          Comment


          • #6
            I don't know what Google Fusion is so I can't comment on that.

            The shapefile only contains projected coordinates so if you are looking for lon/lat, you'll have to look elsewhere.

            You are correct that geo2xy (from SSC) can convert from lat/lon to (x,y) (and then only for a few projection) but it does not do the inverse.

            The simplest is to convert the shapefile to lat/lon using something like ArcGIS.

            Comment


            • #7
              OK. Thanks Robert. I don't use ArcGIS or any other mapping tools so I will have to try something else.

              See here for Google fusion maps: https://support.google.com/fusiontab.../2527132?hl=en

              Paul

              Comment


              • #8
                How did you resolve this issue Paul. What converter did you use?

                Comment


                • #9
                  Anyone else stumbling on this thread with the same problem: you can find a guide here which shows how to convert a weird shapefile format into the more standard WGS84 system using QGIS (free and open source). It is quite easy and worked brilliantly for my shapefile of UK post codes which was intially using the OSGB_1936_British_National_Grid system.

                  Comment


                  • #10
                    I am trying to use geo2xy to convert long lat into UTM system (for Nepal). (I have limited knowledge of UTM system.)

                    The simple code I used is

                    ************************************************** ************
                    clear all

                    input ///
                    latitude longitude
                    27.48833 83.4575
                    27.4825 83.44583
                    27.50528 83.46194
                    end

                    geo2xy latitude longitude , projection( mercator, 6378137 298.257223563 `lonO' ) gen(y_c x_c)
                    ************************************************** ********************

                    I tried different value for `lonO' (including default) and none seem to produce the correct UTM values.

                    // For Nepal, it looks like: WGS-84 Zone: 45 NW, which I used online converter to get the correct UTM values. I also tried R. The correct UTM values are
                    +--------------------------------------------------------------------------------------------+
                    | _ID _X _Y
                    |--------------------------------------------------------------------------------------------|
                    | 1 149932.23 3045523.4
                    | 2 148759.62 3044910
                    | 3 150424.97 3047390.5
                    +--------------------------------------------------------------------------------------------+

                    I would appreciate getting your feedback. Thanks.

                    Best,
                    Alok

                    Comment

                    Working...
                    X