Solved

save .lyr (layer file) programmatically in ArcGIS 8

Posted on 2004-04-14
2
377 Views
Last Modified: 2010-08-05
I've been up and down on Esri's website trying to find the solution to this, but can't get it to work. Basically I created a tool that when clicked creates a layer file for each map layer loaded. However they are only getting set to absolute paths, not relative so if I move it to another computer with the same structure but different drive letter it cannot find the layer. It works great through the ArcMap interface when I save a layer file manually but won't work programmatically. Something in the way the layer gets saved is the problem. Anyone have any idea how to fix this? thanks

guid
0
Comment
Question by:guidway
2 Comments
 
LVL 12

Author Comment

by:guidway
ID: 10875137
solved it, the solution is below, requesting closure of this question:

Public Sub StoreRelativeBase(inLayer As ILayer, inRelBase As String)
  Dim pDataLayer As IDataLayer2
  Set pDataLayer = inLayer
      pDataLayer.RelativeBase = inRelBase
  Dim pGxLayer As IGxLayer
  Dim pGxFile As IGxFile
     
  Set pGxLayer = New GxLayer
  Set pGxFile = pGxLayer
      pGxFile.Path = inRelBase & inLayer.Name & ".lyr"
      Set pGxLayer.Layer = inLayer
End Sub
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 10875824
Closed, 500 points refunded.
modulo
Community Support Moderator
Experts Exchange
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Gmap geocoding details 10 1,419
Creating square around the given latitude and longitude in mapinfo 22 1,501
List of timezones and GPS co-ordinates? 3 359
CLUSTER Postgres relation on gist index 2 240
I feel like more and more people want to know how to programmatically convert addresses into geospatial locations. So in this article, I will show you how you can do it with Bing Maps. I'm going to use PowerShell, which is a nice scripting language,…
Introduction This article is designed to assist GIS (Geographic Information System) and GPS (Global Positioning System) developers using ESRI ArcGIS and other spatial information management systems.   For the uninitiated the concept of projectio…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question